https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71472
Bug ID: 71472 Summary: Wlogical-op misses exhaustive-or case (... || A) || B Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: terra at gnome dot org Target Milestone: --- g++ 6.1 fails to complain about "bar" below. The other two get the expected "logical 'or' of collectively exhaustive tests is always true" warning. enum Enum { ENUM_A, ENUM_B, ENUM_C }; int foo (enum Enum e) { // This produces a warning return e != ENUM_A || e != ENUM_B; } int bar (int i, enum Enum e) { // This does not produce a warning return i != 42 || e != ENUM_A || e != ENUM_B; } int baz (int i, enum Enum e) { // This produces a warning return e != ENUM_A || e != ENUM_B || i != 42; }