[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 11:37:14 PDT 2025


================
@@ -71,6 +71,12 @@ namespace test_misplacement {
 [[]] union union_attr2; //expected-error{{misplaced attributes}}
 [[]] enum  E2 { }; //expected-error{{misplaced attributes}}
 }
+struct S1 { __attribute__((deprecated)) alignas(16) int x; }; // expected-none
+class C1 { __attribute__((deprecated)) alignas(16) int x; }; // expected-none
----------------
DenisGZM wrote:

Thanks for the tests. Also added these for C23 testing, but there are some differences:
In C23 alignas is sticked to type (and I think __attribute__ is sticked to type too), so there are less valid combinations.

For invalid cases we've only got `an attribute list cannot appear here`

https://github.com/llvm/llvm-project/pull/133107


More information about the cfe-commits mailing list