Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++1z -emit-pch -o %t.1.ast %S/Inputs/class-template1.cpp |
| 2 | // RUN: %clang_cc1 -std=c++1z -emit-pch -o %t.2.ast %S/Inputs/class-template2.cpp |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -std=c++1z -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 4 | |
| 5 | static_assert(sizeof(X0<char>().getValue(1)) == sizeof(char)); |
| 6 | static_assert(sizeof(X0<int>().getValue(1)) == sizeof(int)); |
| 7 | |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 8 | // CHECK: class-template1.cpp:9:14: warning: non-type template parameter declared with incompatible types in different translation units ('int' vs. 'long') |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 9 | // CHECK: class-template2.cpp:9:15: note: declared here with type 'long' |
| 10 | |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 11 | // CHECK: class-template1.cpp:12:14: warning: template parameter has different kinds in different translation units |
Kadir Cetinkaya | fd019ed | 2019-10-01 14:08:51 +0000 | [diff] [blame] | 12 | // CHECK: class-template2.cpp:12:18: note: template parameter declared here |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 13 | |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 14 | // CHECK: class-template1.cpp:18:23: warning: non-type template parameter declared with incompatible types in different translation units ('long' vs. 'int') |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 15 | // CHECK: class-template2.cpp:18:23: note: declared here with type 'int' |
| 16 | |
Kadir Cetinkaya | fd019ed | 2019-10-01 14:08:51 +0000 | [diff] [blame] | 17 | // CHECK: class-template1.cpp:21:18: warning: template parameter has different kinds in different translation units |
| 18 | // CHECK: class-template2.cpp:21:31: note: template parameter declared here |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 19 | |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 20 | // CHECK: class-template2.cpp:27:20: warning: external variable 'x0r' declared with incompatible types in different translation units ('X0<double> *' vs. 'X0<float> *') |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 21 | // CHECK: class-template1.cpp:26:19: note: declared here with type 'X0<float> *' |
| 22 | |
| 23 | // CHECK: class-template1.cpp:35:8: warning: type 'X0<wchar_t>' has incompatible definitions in different translation units |
| 24 | // CHECK: class-template1.cpp:36:7: note: field 'member' has type 'int' here |
| 25 | // CHECK: class-template2.cpp:36:9: note: field 'member' has type 'float' here |
| 26 | |
Reid Kleckner | 2423b7d | 2019-05-14 19:02:39 +0000 | [diff] [blame] | 27 | // CHECK: 6 warnings generated. |
Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 28 | // CHECK-NOT: static_assert |