brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 21b212f Raw
81 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks2// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks -fexperimental-new-constant-interpreter3 4// expected-no-diagnostics5 6enum gcc_type_class {7  no_type_class = -1,8  void_type_class, integer_type_class, char_type_class,9  enumeral_type_class, boolean_type_class,10  pointer_type_class, reference_type_class, offset_type_class,11  real_type_class, complex_type_class,12  function_type_class, method_type_class,13  record_type_class, union_type_class,14  array_type_class, string_type_class,15  lang_type_class, opaque_type_class,16  bitint_type_class, vector_type_class17};18 19void foo(void) {20  int i;21  char c;22  enum { red, green, blue } enum_obj;23  int *p;24  double d;25  _Complex double cc;26  extern void f(void);27  struct { int a; float b; } s_obj;28  union { int a; float b; } u_obj;29  int arr[10];30  int (^block)(void);31  __attribute__((vector_size(16))) int vec;32  typedef __attribute__((ext_vector_type(4))) int evec_t;33  evec_t evec;34  typedef _BitInt(8) int8_t3 __attribute__((ext_vector_type(3)));35  int8_t3 t3;36  typedef _BitInt(16) int16_t3 __attribute__((ext_vector_type(4)));37  int16_t3 t4;38  typedef _BitInt(32) int32_t3 __attribute__((ext_vector_type(5)));39  int32_t3 t5;40  typedef _BitInt(64) int64_t3 __attribute__((ext_vector_type(6)));41  int64_t3 t6;42  typedef _BitInt(8) vint8_t3 __attribute__((vector_size(3)));43  vint8_t3 vt3;44  typedef _BitInt(16) vint16_t3 __attribute__((vector_size(4)));45  vint16_t3 vt4;46  typedef _BitInt(32) vint32_t3 __attribute__((vector_size(8)));47  vint32_t3 vt5;48  typedef _BitInt(64) vint64_t3 __attribute__((vector_size(16)));49  vint64_t3 vt6;50  _BitInt(16) bitint;51 52  _Atomic int atomic_i;53  _Atomic double atomic_d;54  _Complex int complex_i;55  _Complex double complex_d;56 57  int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1];58  int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1];59  int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1];60  int a4[__builtin_classify_type(enum_obj) == integer_type_class ? 1 : -1];61  int a5[__builtin_classify_type(p) == pointer_type_class ? 1 : -1];62  int a6[__builtin_classify_type(d) == real_type_class ? 1 : -1];63  int a7[__builtin_classify_type(cc) == complex_type_class ? 1 : -1];64  int a8[__builtin_classify_type(f) == pointer_type_class ? 1 : -1];65  int a0[__builtin_classify_type(s_obj) == record_type_class ? 1 : -1];66  int a10[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1];67  int a11[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1];68  int a12[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1];69  int a13[__builtin_classify_type(block) == no_type_class ? 1 : -1];70  int a14[__builtin_classify_type(vec) == vector_type_class ? 1 : -1];71  int a15[__builtin_classify_type(evec) == vector_type_class ? 1 : -1];72  int a16[__builtin_classify_type(atomic_i) == integer_type_class ? 1 : -1];73  int a17[__builtin_classify_type(atomic_d) == real_type_class ? 1 : -1];74  int a18[__builtin_classify_type(complex_i) == complex_type_class ? 1 : -1];75  int a19[__builtin_classify_type(complex_d) == complex_type_class ? 1 : -1];76  int a20[__builtin_classify_type(bitint) == bitint_type_class ? 1 : -1];77}78 79extern int (^p)(void);80int n = __builtin_classify_type(p);81