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