[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / temp_class_order.cpp
blobfcf0325b7bbc9e6cad2131183da3103d05d83f95
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template<typename T, typename U>
4 struct X1 {
5 static const int value = 0;
6 };
8 template<typename T, typename U>
9 struct X1<T*, U*> {
10 static const int value = 1;
13 template<typename T>
14 struct X1<T*, T*> {
15 static const int value = 2;
18 template<typename T>
19 struct X1<const T*, const T*> {
20 static const int value = 3;
23 int array0[X1<int, int>::value == 0? 1 : -1];
24 int array1[X1<int*, float*>::value == 1? 1 : -1];
25 int array2[X1<int*, int*>::value == 2? 1 : -1];
26 typedef const int* CIP;
27 int array3[X1<const int*, CIP>::value == 3? 1 : -1];
29 template<typename T, typename U>
30 struct X2 { };
32 template<typename T, typename U>
33 struct X2<T*, U> { }; // expected-note{{matches}}
35 template<typename T, typename U>
36 struct X2<T, U*> { }; // expected-note{{matches}}
38 template<typename T, typename U>
39 struct X2<const T*, const U*> { };
41 X2<int*, int*> x2a; // expected-error{{ambiguous}}
42 X2<const int*, const int*> x2b;