https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121524
Bug ID: 121524
Summary: [15 Regression] Trailing alignas leaks into subsequent
types, sometimes
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: headch at gmail dot com
Target Milestone: ---
Consider the following code:
using UT = unsigned int;
struct Foo {
UT foo[8] alignas(32);
};
struct Bar {
UT a[8];
UT b;
};
static_assert(sizeof(Bar) == 36);
This code causes the static_assert to fail. Various slight permutations don’t
(such as putting the alignas at the beginning of the declaration instead of the
end, not using a type alias, or changing the size of foo). Clang rejects
alignas at the back like this, so this might be invalid code and might be
related to #69572 or #90847, but it’s a slightly different structure than any
of the code quoted there. Also the alignas isn’t ignored or applied; instead,
it leaks out and affects an unrelated type.