MSVC applies these to the following declaration only if present, otherwise
silently ignores them whereas we'll issue a warning.
Handling differs from ordinary attributes appearing in the same place, so add a
Sema test to make sure we get it right.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195577
91177308-0d34-0410-b5e6-
96231b3b80d8
case tok::l_paren: // struct foo {...} ( x);
case tok::comma: // __builtin_offsetof(struct foo{...} ,
case tok::kw_operator: // struct foo operator ++() {...}
+ case tok::kw___declspec: // struct foo {...} __declspec(...)
return true;
case tok::colon:
return CouldBeBitfield; // enum E { ... } : 2;
// expected-error@+1 {{base 'SealedType' is marked 'sealed'}}
struct InheritFromSealed : SealedType {};
+
+void AfterClassBody() {
+ // expected-warning@+1 {{attribute 'deprecated' is ignored, place it after "struct" to apply attribute to type declaration}}
+ struct D {} __declspec(deprecated);
+
+ struct __declspec(align(4)) S {} __declspec(align(8)) s1;
+ S s2;
+ _Static_assert(__alignof(S) == 4, "");
+ _Static_assert(__alignof(s1) == 8, "");
+ _Static_assert(__alignof(s2) == 4, "");
+}