1 // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s 2 3 // expected-no-diagnostics 4 5 enum gcc_type_class { 6 no_type_class = -1, 7 void_type_class, integer_type_class, char_type_class, 8 enumeral_type_class, boolean_type_class, 9 pointer_type_class, reference_type_class, offset_type_class, 10 real_type_class, complex_type_class, 11 function_type_class, method_type_class, 12 record_type_class, union_type_class, 13 array_type_class, string_type_class, 14 lang_type_class 15 }; 16 17 class cl { 18 public: 19 void bar() {} 20 int baz; 21 }; 22 23 int builtin_result; 24 25 void foo() { 26 int i; 27 char c; 28 enum { red, green, blue} enum_obj; 29 bool b; 30 int *p; 31 int &r = i; 32 double d; 33 extern void f(); 34 cl cl_obj; 35 union { int a; float b; } u_obj; 36 int arr[10]; 37 int (^block)(); 38 __attribute__((vector_size(16))) int vec; 39 typedef __attribute__((ext_vector_type(4))) int evec_t; 40 evec_t evec; 41 _Atomic int atomic_i; 42 _Atomic double atomic_d; 43 _Complex int complex_i; 44 _Complex double complex_d; 45 46 int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1]; 47 int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1]; 48 int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1]; 49 int a4[__builtin_classify_type(enum_obj) == enumeral_type_class ? 1 : -1]; 50 int a5[__builtin_classify_type(b) == boolean_type_class ? 1 : -1]; 51 int a6[__builtin_classify_type(p) == pointer_type_class ? 1 : -1]; 52 int a7[__builtin_classify_type(r) == integer_type_class ? 1 : -1]; 53 int a8[__builtin_classify_type(&cl::baz) == offset_type_class ? 1 : -1]; 54 int a9[__builtin_classify_type(d) == real_type_class ? 1 : -1]; 55 int a10[__builtin_classify_type(f) == pointer_type_class ? 1 : -1]; 56 int a11[__builtin_classify_type(&cl::bar) == record_type_class ? 1 : -1]; 57 int a12[__builtin_classify_type(cl_obj) == record_type_class ? 1 : -1]; 58 int a13[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1]; 59 int a14[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1]; 60 int a15[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1]; 61 int a16[__builtin_classify_type(block) == no_type_class ? 1 : -1]; 62 int a17[__builtin_classify_type(vec) == no_type_class ? 1 : -1]; 63 int a18[__builtin_classify_type(evec) == no_type_class ? 1 : -1]; 64 int a19[__builtin_classify_type(atomic_i) == integer_type_class ? 1 : -1]; 65 int a20[__builtin_classify_type(atomic_d) == real_type_class ? 1 : -1]; 66 int a21[__builtin_classify_type(complex_i) == complex_type_class ? 1 : -1]; 67 int a22[__builtin_classify_type(complex_d) == complex_type_class ? 1 : -1]; 68 } 69 70