Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
      2 // expected-no-diagnostics
      3 
      4 // PR3433
      5 double g1;
      6 short chk1[__alignof__(g1) == 8 ? 1 : -1];
      7 short chk2[__alignof__(double) == 8 ? 1 : -1];
      8 
      9 long long g2;
     10 short chk1[__alignof__(g2) == 8 ? 1 : -1];
     11 short chk2[__alignof__(long long) == 8 ? 1 : -1];
     12 
     13 unsigned long long g5;
     14 short chk1[__alignof__(g5) == 8 ? 1 : -1];
     15 short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1];
     16 
     17 _Complex double g3;
     18 short chk1[__alignof__(g3) == 8 ? 1 : -1];
     19 short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];
     20 
     21 // PR6362
     22 struct __attribute__((packed)) {unsigned int a;} g4;
     23 short chk1[__alignof__(g4) == 1 ? 1 : -1];
     24 short chk2[__alignof__(g4.a) == 1 ? 1 : -1];
     25 
     26 
     27 // PR5637
     28 
     29 #define ALIGNED(x) __attribute__((aligned(x)))
     30 
     31 typedef ALIGNED(2) struct {
     32   char a[3];
     33 } T;
     34 
     35 short chk1[sizeof(T)       == 3 ? 1 : -1];
     36 short chk2[sizeof(T[1])    == 4 ? 1 : -1];
     37 short chk3[sizeof(T[2])    == 6 ? 1 : -1];
     38 short chk4[sizeof(T[2][1]) == 8 ? 1 : -1];
     39 short chk5[sizeof(T[1][2]) == 6 ? 1 : -1];
     40 
     41 typedef struct ALIGNED(2) {
     42   char a[3];
     43 } T2;
     44 
     45 short chk1[sizeof(T2)       == 4 ? 1 : -1];
     46 short chk2[sizeof(T2[1])    == 4 ? 1 : -1];
     47 short chk3[sizeof(T2[2])    == 8 ? 1 : -1];
     48 short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1];
     49 short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1];
     50