Home | History | Annotate | Download | only in temp.deduct
      1 // RUN: %clang_cc1 -verify %s
      2 
      3 typedef char one_byte;
      4 struct two_bytes { char data[2]; };
      5 
      6 template<typename T> one_byte __is_class_check(int T::*);
      7 template<typename T> two_bytes __is_class_check(...);
      8 
      9 template<typename T> struct is_class {
     10   static const bool value = sizeof(__is_class_check<T>(0)) == 1;
     11 };
     12 
     13 struct X { };
     14 
     15 int array0[is_class<X>::value? 1 : -1];
     16 int array1[is_class<int>::value? -1 : 1];
     17 int array2[is_class<char[3]>::value? -1 : 1];
     18 
     19 namespace instantiation_order1 {
     20   template<typename T>
     21   struct it_is_a_trap {
     22     typedef typename T::trap type;
     23   };
     24 
     25   template<bool, typename T = void>
     26   struct enable_if {
     27     typedef T type;
     28   };
     29 
     30   template<typename T>
     31   struct enable_if<false, T> { };
     32 
     33   template<typename T>
     34   typename enable_if<sizeof(T) == 17>::type
     35   f(const T&, typename it_is_a_trap<T>::type* = 0);
     36 
     37   void f(...);
     38 
     39   void test_f() {
     40     f('a');
     41   }
     42 }
     43