https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69672
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2016-05-18 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |4.9.3, 5.3.0, 6.1.0, 7.0 Severity|normal |enhancement --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Unlike bug 69670 I think it makes sense to consider this change request for two reasons: first, because when one of the enumerated types is anonymous it seems like a good indication that its enumerators are intended to be used as poor man's integer constants whose type doesn't matter, and second, because Clang doesn't warn in this case. $ cat u.cpp && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic u.cpp enum E { e }; enum { f = e }; int foo (E a) { return a == f; } u.cpp: In function ‘int foo(E)’: u.cpp:6:15: warning: comparison between ‘enum E’ and ‘enum<anonymous>’ [-Wenum-compare] return a == f; ^