http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52763
Bug #: 52763 Summary: Warning if compare between enum and non-enum type Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: gccrepo...@gmx-topmail.de Hi, the following program doesn't create a warning. It would be nice to get an warning each time a enumeration type is compared to a non enumeration type, because it forces better readable code (at least in my opinion). I compiled this with 'g++ -Wall -Wextra -Wconversion -Werror'. Best regards, Mikka typedef enum { NONE = 0, ONE = 1, TWO = 2 } tEnumType; int main(void){ tEnumType var1 = TWO; //Warn here, because we compare an enum to a non-enum type (1) //should be 'if (var1 == ONE)' if (var1 == 1) return 1; else return 0; }