https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69572

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Another invalid case that's accepted:

$ cat x.cpp && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -O2 -S -Wall
-Wextra -Wpedantic -std=c++11 x.cpp
struct alignas (1) B;
struct alignas (2) B;
struct alignas (4) B { int i; };

This is required to be rejected by the following text in 7.6.2 Alignment
specifier, para 6:

If the defining declaration of an entity has an alignment-specifier, any
non-defining declaration of that entity shall either specify equivalent
alignment or have no alignment-specifier. Conversely, if any declaration of an
entity has an alignment-specifier, every defining declaration of that entity
shall specify an equivalent alignment. No diagnostic is required if
declarations of an entity have different alignment-specifiers in different
translation units.

Reply via email to