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