[clang] [CLANG] Enable alignas after GNU attributes (PR #133107)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 4 08:04:33 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
----------------
AaronBallman wrote:
I'd like to see a test case like which shows the various combinations of orders we can handle (no need to test `struct` and `class` separately as those follow the same code paths).
```
class C {
__attribute__(()) [[]] alignas(int) int x;
__attribute__(()) alignas(int) [[]] int y;
[[]] __attribute__(()) alignas(int) int z;
alignas(int) [[]] __attribute__(()) int a;
};
```
We should also be sure to test this in C23 mode to make sure we get the same behavior in C as well as in C++.
https://github.com/llvm/llvm-project/pull/133107
More information about the cfe-commits
mailing list