1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 template<int I, int J, class T> struct X { 3 static const int value = 0; 4 }; 5 6 template<int I, int J> struct X<I, J, int> { 7 static const int value = 1; 8 }; 9 10 template<int I> struct X<I, I, int> { 11 static const int value = 2; 12 }; 13 14 int array0[X<0, 0, float>::value == 0? 1 : -1]; 15 int array1[X<0, 1, int>::value == 1? 1 : -1]; 16 int array2[X<0, 0, int>::value == 2? 1 : -1]; 17 18 namespace DependentSubstPartialOrdering { 19 template<typename T, typename U = void, typename V = void> 20 struct X { 21 static const unsigned value = 1; 22 }; 23 24 template<typename T, typename U> 25 struct X<T, U, typename T::is_b> { 26 static const unsigned value = 2; 27 }; 28 29 template<typename T> 30 struct X<T, typename T::is_a, typename T::is_b> { 31 static const unsigned value = 3; 32 }; 33 34 struct X1 { }; 35 36 struct X2 { 37 typedef void is_b; 38 }; 39 40 struct X3 { 41 typedef void is_a; 42 typedef void is_b; 43 }; 44 45 int check_X1[X<X1, void, void>::value == 1? 1 : -1]; 46 int check_X2[X<X2, void, void>::value == 2? 1 : -1]; 47 int check_X3[X<X3, void, void>::value == 3? 1 : -1]; 48 } 49