Home | History | Annotate | Download | only in SemaCXX
      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 
     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 
     38   int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1];
     39   int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1];
     40   int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1];
     41   int a4[__builtin_classify_type(enum_obj) == enumeral_type_class ? 1 : -1];
     42   int a5[__builtin_classify_type(b) == boolean_type_class ? 1 : -1];
     43   int a6[__builtin_classify_type(p) == pointer_type_class ? 1 : -1];
     44   int a7[__builtin_classify_type(r) == integer_type_class ? 1 : -1];
     45   int a8[__builtin_classify_type(&cl::baz) == offset_type_class ? 1 : -1];
     46   int a9[__builtin_classify_type(d) == real_type_class ? 1 : -1];
     47   int a10[__builtin_classify_type(f) == function_type_class ? 1 : -1];
     48   int a11[__builtin_classify_type(&cl::bar) == method_type_class ? 1 : -1];
     49   int a12[__builtin_classify_type(cl_obj) == record_type_class ? 1 : -1];
     50   int a13[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1];
     51   int a14[__builtin_classify_type(arr) == array_type_class ? 1 : -1];
     52   int a15[__builtin_classify_type("abc") == array_type_class ? 1 : -1];
     53 }
     54 
     55