| 1 |
// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s |
| 2 |
|
| 3 |
// This should ignore the alignment and issue a warning about |
| 4 |
// align not being used |
| 5 |
auto func() -> __declspec(align(16)) int; // expected-warning{{attribute ignored when parsing type}} |
| 6 |
static_assert(alignof(decltype(func())) == alignof(int), "error"); |
| 7 |
|
| 8 |
// The following should NOT assert since alignment should |
| 9 |
// follow the type |
| 10 |
struct Test { int a; }; |
| 11 |
using AlignedTest = __declspec(align(16)) const Test; |
| 12 |
static_assert(alignof(AlignedTest) == 16, "error"); |
| 13 |
|
| 14 |
// Same here, no declaration to shift to |
| 15 |
int i = (__declspec(align(16))int)12; // expected-warning{{attribute ignored when parsing type}} |
| 16 |
|
| 17 |
// But there is a declaration here! |
| 18 |
typedef __declspec(align(16)) int Foo; |
| 19 |
static_assert(alignof(Foo) == 16, "error"); |
| 20 |
|