1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks |
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 | void foo() { |
18 | int i; |
19 | char c; |
20 | enum { red, green, blue } enum_obj; |
21 | int *p; |
22 | double d; |
23 | _Complex double cc; |
24 | extern void f(); |
25 | struct { int a; float b; } s_obj; |
26 | union { int a; float b; } u_obj; |
27 | int arr[10]; |
28 | int (^block)(); |
29 | __attribute__((vector_size(16))) int vec; |
30 | typedef __attribute__((ext_vector_type(4))) int evec_t; |
31 | evec_t evec; |
32 | _Atomic int atomic_i; |
33 | _Atomic double atomic_d; |
34 | _Complex int complex_i; |
35 | _Complex double complex_d; |
36 | |
37 | int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1]; |
38 | int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1]; |
39 | int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1]; |
40 | int a4[__builtin_classify_type(enum_obj) == integer_type_class ? 1 : -1]; |
41 | int a5[__builtin_classify_type(p) == pointer_type_class ? 1 : -1]; |
42 | int a6[__builtin_classify_type(d) == real_type_class ? 1 : -1]; |
43 | int a7[__builtin_classify_type(cc) == complex_type_class ? 1 : -1]; |
44 | int a8[__builtin_classify_type(f) == pointer_type_class ? 1 : -1]; |
45 | int a0[__builtin_classify_type(s_obj) == record_type_class ? 1 : -1]; |
46 | int a10[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1]; |
47 | int a11[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1]; |
48 | int a12[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1]; |
49 | int a13[__builtin_classify_type(block) == no_type_class ? 1 : -1]; |
50 | int a14[__builtin_classify_type(vec) == no_type_class ? 1 : -1]; |
51 | int a15[__builtin_classify_type(evec) == no_type_class ? 1 : -1]; |
52 | int a16[__builtin_classify_type(atomic_i) == integer_type_class ? 1 : -1]; |
53 | int a17[__builtin_classify_type(atomic_d) == real_type_class ? 1 : -1]; |
54 | int a18[__builtin_classify_type(complex_i) == complex_type_class ? 1 : -1]; |
55 | int a19[__builtin_classify_type(complex_d) == complex_type_class ? 1 : -1]; |
56 | } |
57 | |
58 | extern int (^p)(); |
59 | int n = __builtin_classify_type(p); |
60 | |