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