1 // RUN: %clang_cc1 -fsyntax-only -verify %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 
foo()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 
29   int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1];
30   int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1];
31   int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1];
32   int a4[__builtin_classify_type(enum_obj) == integer_type_class ? 1 : -1];
33   int a5[__builtin_classify_type(p) == pointer_type_class ? 1 : -1];
34   int a6[__builtin_classify_type(d) == real_type_class ? 1 : -1];
35   int a7[__builtin_classify_type(cc) == complex_type_class ? 1 : -1];
36   int a8[__builtin_classify_type(f) == pointer_type_class ? 1 : -1];
37   int a0[__builtin_classify_type(s_obj) == record_type_class ? 1 : -1];
38   int a10[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1];
39   int a11[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1];
40   int a12[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1];
41 }
42 
43