1 // RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify 2 3 #define SA(n, p) int a##n[(p) ? 1 : -1] 4 5 struct A { int a; }; 6 SA(0, sizeof(A) == 4); 7 8 struct B { }; 9 SA(1, sizeof(B) == 1); 10 11 struct C : A, B { }; 12 SA(2, sizeof(C) == 4); 13 14 struct D { }; 15 struct E : D { }; 16 struct F : E { }; 17 18 struct G : E, F { }; 19 SA(3, sizeof(G) == 2); 20 21 struct Empty { Empty(); }; 22 23 struct I : Empty { 24 Empty e; 25 }; 26 SA(4, sizeof(I) == 2); 27 28 struct J : Empty { 29 Empty e[2]; 30 }; 31 SA(5, sizeof(J) == 3); 32 33 template<int N> struct Derived : Empty, Derived<N - 1> { 34 }; 35 template<> struct Derived<0> : Empty { }; 36 37 struct S1 : virtual Derived<10> { 38 Empty e; 39 }; 40 SA(6, sizeof(S1) == 24); 41 42 struct S2 : virtual Derived<10> { 43 Empty e[2]; 44 }; 45 SA(7, sizeof(S2) == 24); 46 47 struct S3 { 48 Empty e; 49 }; 50 51 struct S4 : Empty, S3 { 52 }; 53 SA(8, sizeof(S4) == 2); 54 55 struct S5 : S3, Empty {}; 56 SA(9, sizeof(S5) == 2); 57 58 struct S6 : S5 { }; 59 SA(10, sizeof(S6) == 2); 60 61 struct S7 : Empty { 62 void *v; 63 }; 64 SA(11, sizeof(S7) == 8); 65