https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100879
Bug ID: 100879 Summary: gcc is complaining of a signed compare when comparing enums of different types (same underlying type) Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andre at kostur dot net Target Milestone: --- With the following test code: enum e1 { e1val }; enum e2 { e3val }; int main( int, char * [] ) { if ( e1val == e3val ) return 1; } The compiler emits two warnings: <source>: In function 'int main(int, char**)': <source>:6:15: warning: comparison between 'enum e1' and 'enum e2' [-Wenum-compare] 6 | if ( e1val == e3val ) return 1; | ~~~~~~^~~~~~~~ <source>:6:15: warning: comparison between types 'e1' and 'e2' [-Wsign-compare] The first is correct, but the second warning seems wrong. There is no sign mismatch as both enums would have the same underlying type. gcc 9.3 does not seem to suffer this problem. gcc 10.1 does, and appears every version up to at least 11.1 does. (Checked on compiler-explorer)