https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66966
Bug ID: 66966 Summary: Missing diagnostic message for ill-formed program with anonymous enum Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: anders.granlund.0 at gmail dot com Target Milestone: --- Consider the following program (prog.cc): enum {}; int main() {} This is ill-formed according to [dcl.dcl]/5 of the c++ standard: http://eel.is/c++draft/dcl.dcl#5 Compile the program with the following command line: gcc prog.cc -std=c++98 -pedantic-errors -w Observe that no diagnostic message is emitted. At least one diagnostic message is expected since the program is ill-formed. The bug 54216 that has been fixed seems to be similar. The difference is that I'm using -w and -pedantic-errors. Could the bug be caused by a general problem of some errors getting hidden by the combination -w and -pedantic-errors? I suspect this since I get the following error message if I remove -w: error: ISO C++ forbids empty anonymous enum Output for gcc -v (the problem seems to be quite independent of this however): Using built-in specs. COLLECT_GCC=/usr/local/gcc-head/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/heads/gcc/gcc-source/configure --prefix=/usr/local/gcc-head --enable-languages=c,c++ --enable-lto --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls Thread model: posix gcc version 6.0.0 20150721 (experimental) (GCC) COLLECT_GCC_OPTIONS='-o' 'prog.exe' '-std=c++98' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE prog.cc -quiet -dumpbase prog.cc -mtune=generic -march=x86-64 -auxbase prog -std=c++98 -version -o /tmp/ccHJNWUA.s GNU C++98 (GCC) version 6.0.0 20150721 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 6.0.0 20150721 (experimental), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 warning: GMP header version 5.1.2 differs from library version 5.0.2. warning: MPFR header version 3.1.2 differs from library version 3.1.0-p3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../include/c++/6.0.0 /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../include/c++/6.0.0/x86_64-unknown-linux-gnu /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../include/c++/6.0.0/backward /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/include /usr/local/include /usr/local/gcc-head/include /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. GNU C++98 (GCC) version 6.0.0 20150721 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 6.0.0 20150721 (experimental), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1 warning: GMP header version 5.1.2 differs from library version 5.0.2. warning: MPFR header version 3.1.2 differs from library version 3.1.0-p3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 498fb50b10eacf300a28f79d04f435a8 COLLECT_GCC_OPTIONS='-o' 'prog.exe' '-std=c++98' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as -v --64 -o /tmp/ccpk87pk.o /tmp/ccHJNWUA.s GNU assembler version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.22 COMPILER_PATH=/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/:/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/:/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/:/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/ LIBRARY_PATH=/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/:/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-o' 'prog.exe' '-std=c++98' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/collect2 -plugin /usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/liblto_plugin.so -plugin-opt=/usr/local/gcc-head/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cc7VqyW3.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o prog.exe /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/crtbegin.o -L/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0 -L/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/../../.. -rpath /usr/local/gcc-head/lib64 -lpthread /tmp/ccpk87pk.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/gcc-head/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o