File: test.cpp

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (28 lines) | stat: -rw-r--r-- 1,837 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %clang_cc1 -std=c++1z -emit-pch -o %t.1.ast %S/Inputs/class-template1.cpp
// RUN: %clang_cc1 -std=c++1z -emit-pch -o %t.2.ast %S/Inputs/class-template2.cpp
// RUN: %clang_cc1 -std=c++1z  -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s

static_assert(sizeof(X0<char>().getValue(1)) == sizeof(char));
static_assert(sizeof(X0<int>().getValue(1)) == sizeof(int));

// CHECK: class-template1.cpp:9:14: warning: non-type template parameter declared with incompatible types in different translation units ('int' vs. 'long')
// CHECK: class-template2.cpp:9:15: note: declared here with type 'long'

// CHECK: class-template1.cpp:12:14: warning: template parameter has different kinds in different translation units
// CHECK: class-template2.cpp:12:10: note: template parameter declared here

// CHECK: class-template1.cpp:18:23: warning: non-type template parameter declared with incompatible types in different translation units ('long' vs. 'int')
// CHECK: class-template2.cpp:18:23: note: declared here with type 'int'

// CHECK: class-template1.cpp:21:10: warning: template parameter has different kinds in different translation units
// CHECK: class-template2.cpp:21:10: note: template parameter declared here

// CHECK: class-template2.cpp:27:20: warning: external variable 'x0r' declared with incompatible types in different translation units ('X0<double> *' vs. 'X0<float> *')
// CHECK: class-template1.cpp:26:19: note: declared here with type 'X0<float> *'

// CHECK: class-template1.cpp:35:8: warning: type 'X0<wchar_t>' has incompatible definitions in different translation units
// CHECK: class-template1.cpp:36:7: note: field 'member' has type 'int' here
// CHECK: class-template2.cpp:36:9: note: field 'member' has type 'float' here

// CHECK: 6 warnings generated.
// CHECK-NOT: static_assert