1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2*67e74705SXin Li // expected-no-diagnostics 3*67e74705SXin Li 4*67e74705SXin Li // Test that the alignment of a empty direct base class is correctly 5*67e74705SXin Li // inherited by the derived class. 6*67e74705SXin Li 7*67e74705SXin Li struct A { 8*67e74705SXin Li } __attribute__ ((aligned(16))); 9*67e74705SXin Li 10*67e74705SXin Li static_assert(__alignof(A) == 16, "A should be aligned to 16 bytes"); 11*67e74705SXin Li 12*67e74705SXin Li struct B1 : public A { 13*67e74705SXin Li }; 14*67e74705SXin Li 15*67e74705SXin Li static_assert(__alignof(B1) == 16, "B1 should be aligned to 16 bytes"); 16*67e74705SXin Li 17*67e74705SXin Li struct B2 : public A { 18*67e74705SXin Li } __attribute__ ((aligned(2))); 19*67e74705SXin Li 20*67e74705SXin Li static_assert(__alignof(B2) == 16, "B2 should be aligned to 16 bytes"); 21*67e74705SXin Li 22*67e74705SXin Li struct B3 : public A { 23*67e74705SXin Li } __attribute__ ((aligned(4))); 24*67e74705SXin Li 25*67e74705SXin Li static_assert(__alignof(B3) == 16, "B3 should be aligned to 16 bytes"); 26*67e74705SXin Li 27*67e74705SXin Li struct B4 : public A { 28*67e74705SXin Li } __attribute__ ((aligned(8))); 29*67e74705SXin Li 30*67e74705SXin Li static_assert(__alignof(B4) == 16, "B4 should be aligned to 16 bytes"); 31*67e74705SXin Li 32*67e74705SXin Li struct B5 : public A { 33*67e74705SXin Li } __attribute__ ((aligned(16))); 34*67e74705SXin Li 35*67e74705SXin Li static_assert(__alignof(B5) == 16, "B5 should be aligned to 16 bytes"); 36*67e74705SXin Li 37*67e74705SXin Li struct B6 : public A { 38*67e74705SXin Li } __attribute__ ((aligned(32))); 39*67e74705SXin Li 40*67e74705SXin Li static_assert(__alignof(B6) == 32, "B6 should be aligned to 32 bytes"); 41*67e74705SXin Li 42