brintos

brintos / llvm-project-archived public Read only

0
0
Text · 964 B · fcf0325 Raw
43 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3template<typename T, typename U>4struct X1 {5  static const int value = 0;6};7 8template<typename T, typename U>9struct X1<T*, U*> {10  static const int value = 1;11};12 13template<typename T>14struct X1<T*, T*> {15  static const int value = 2;16};17 18template<typename T>19struct X1<const T*, const T*> {20  static const int value = 3;21};22 23int array0[X1<int, int>::value == 0? 1 : -1];24int array1[X1<int*, float*>::value == 1? 1 : -1];25int array2[X1<int*, int*>::value == 2? 1 : -1];26typedef const int* CIP;27int array3[X1<const int*, CIP>::value == 3? 1 : -1];28 29template<typename T, typename U>30struct X2 { };31 32template<typename T, typename U>33struct X2<T*, U> { }; // expected-note{{matches}}34 35template<typename T, typename U>36struct X2<T, U*> { }; // expected-note{{matches}}37 38template<typename T, typename U>39struct X2<const T*, const U*> { };40 41X2<int*, int*> x2a; // expected-error{{ambiguous}}42X2<const int*, const int*> x2b;43