https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96039
Bug ID: 96039 Summary: Missing diagnostic: C++11 alignment specifier on bit-fields Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hstong at ca dot ibm.com Target Milestone: --- According to [dcl.align] in the 2020 DIS for C++, an alignment-specifier shall not be applied to a bit-field. GCC allows such alignment-specifiers with no diagnostic. ### SOURCE (<stdin>): struct A { int x alignas(long long) : 32; }; ### COMPILER INVOCATION: g++ -fsyntax-only -std=c++11 -Wall -Wextra -pedantic-errors -xc++ - ### ACTUAL OUTPUT: (rc=0) ### EXPECTED OUTPUT: Diagnostic message; likely an error. ### COMPILER VERSION INFO (g++ -v): Using built-in specs. COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++ COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head --enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls --enable-lto LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32 Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20200701 (experimental) (GCC)