sfinae-1.cpp revision a5728872c7702ddd09537c95bc3cbd20e1f2fb09
1// RUN: %clang_cc1 %s
2
3typedef char one_byte;
4struct two_bytes { char data[2]; };
5
6template<typename T> one_byte __is_class_check(int T::*);
7template<typename T> two_bytes __is_class_check(...);
8
9template<typename T> struct is_class {
10  static const bool value = sizeof(__is_class_check<T>(0)) == 1;
11};
12
13struct X { };
14
15int array0[is_class<X>::value? 1 : -1];
16int array1[is_class<int>::value? -1 : 1];
17int array2[is_class<char[3]>::value? -1 : 1];
18