2009-09-24 11:22:10 +08:00
|
|
|
// RUN: clang-cc -triple x86_64-unknown-unknown %s -fsyntax-only -verify
|
|
|
|
|
|
|
|
#define SA(n, p) int a##n[(p) ? 1 : -1]
|
|
|
|
|
|
|
|
struct A { int a; };
|
|
|
|
SA(0, sizeof(A) == 4);
|
|
|
|
|
|
|
|
struct B { };
|
|
|
|
SA(1, sizeof(B) == 1);
|
|
|
|
|
|
|
|
struct C : A, B { };
|
|
|
|
SA(2, sizeof(C) == 4);
|
2009-09-24 13:21:31 +08:00
|
|
|
|
|
|
|
struct D { };
|
|
|
|
struct E : D { };
|
|
|
|
struct F : E { };
|
|
|
|
|
|
|
|
struct G : E, F { };
|
|
|
|
SA(3, sizeof(G) == 2);
|
2009-09-25 08:02:51 +08:00
|
|
|
|
2009-09-25 09:23:32 +08:00
|
|
|
struct Empty { Empty(); };
|
2009-09-25 08:02:51 +08:00
|
|
|
|
2009-09-25 09:23:32 +08:00
|
|
|
struct I : Empty {
|
|
|
|
Empty e;
|
2009-09-25 08:02:51 +08:00
|
|
|
};
|
|
|
|
SA(4, sizeof(I) == 2);
|
2009-09-25 09:23:32 +08:00
|
|
|
|
|
|
|
struct J : Empty {
|
|
|
|
Empty e[2];
|
|
|
|
};
|
2009-09-25 09:54:38 +08:00
|
|
|
SA(5, sizeof(J) == 3);
|
|
|
|
|
|
|
|
template<int N> struct Derived : Empty, Derived<N - 1> {
|
|
|
|
};
|
|
|
|
template<> struct Derived<0> : Empty { };
|
|
|
|
|
|
|
|
struct S1 : virtual Derived<10> {
|
|
|
|
Empty e;
|
|
|
|
};
|
|
|
|
SA(6, sizeof(S1) == 24);
|
|
|
|
|
|
|
|
struct S2 : virtual Derived<10> {
|
|
|
|
Empty e[2];
|
|
|
|
};
|
|
|
|
SA(7, sizeof(S2) == 24);
|