21 lines · cpp
1// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s2 3// This should ignore the alignment and issue a warning about4// align not being used5auto func() -> __declspec(align(16)) int; // expected-warning{{attribute ignored when parsing type}}6static_assert(alignof(decltype(func())) == alignof(int), "error");7 8// The following should NOT assert since alignment should9// follow the type10struct Test { int a; };11using AlignedTest = __declspec(align(16)) const Test;12static_assert(alignof(AlignedTest) == 16, "error");13 14// Same here, no declaration to shift to15int i = (__declspec(align(16))int)12; // expected-warning{{attribute ignored when parsing type}}16 17// But there is a declaration here!18typedef __declspec(align(16)) int Foo;19static_assert(alignof(Foo) == 16, "error");20 21