Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 template <typename T>
      3 struct A {
      4   char a __attribute__((aligned(16)));
      5 
      6   struct B {
      7     typedef T __attribute__((aligned(16))) i16;
      8     i16 x;
      9   };
     10 };
     11 int a[sizeof(A<int>) == 16 ? 1 : -1];
     12 int a2[sizeof(A<int>::B) == 16 ? 1 : -1];
     13 
     14 // rdar://problem/8243419
     15 namespace test1 {
     16   template <typename T> struct A {
     17     int a;
     18     T b[0];
     19   } __attribute__((packed));
     20 
     21   typedef A<unsigned long> type;
     22 
     23   int test0[sizeof(type) == 4 ? 1 : -1];
     24   int test1[__builtin_offsetof(type, a) == 0 ? 1 : -1];
     25   int test2[__builtin_offsetof(type, b) == 4 ? 1 : -1];
     26 }
     27