| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
template<typename T, typename U> |
| 4 |
struct X1 { |
| 5 |
static const int value = 0; |
| 6 |
}; |
| 7 |
|
| 8 |
template<typename T, typename U> |
| 9 |
struct X1<T*, U*> { |
| 10 |
static const int value = 1; |
| 11 |
}; |
| 12 |
|
| 13 |
template<typename T> |
| 14 |
struct X1<T*, T*> { |
| 15 |
static const int value = 2; |
| 16 |
}; |
| 17 |
|
| 18 |
template<typename T> |
| 19 |
struct X1<const T*, const T*> { |
| 20 |
static const int value = 3; |
| 21 |
}; |
| 22 |
|
| 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]; |
| 28 |
|
| 29 |
template<typename T, typename U> |
| 30 |
struct X2 { }; |
| 31 |
|
| 32 |
template<typename T, typename U> |
| 33 |
struct X2<T*, U> { }; // expected-note{{matches}} |
| 34 |
|
| 35 |
template<typename T, typename U> |
| 36 |
struct X2<T, U*> { }; // expected-note{{matches}} |
| 37 |
|
| 38 |
template<typename T, typename U> |
| 39 |
struct X2<const T*, const U*> { }; |
| 40 |
|
| 41 |
X2<int*, int*> x2a; // expected-error{{ambiguous}} |
| 42 |
X2<const int*, const int*> x2b; |