http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60664
Bug ID: 60664 Summary: bool / out of range int comparison warning failure Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Consider the following code: extern bool f(int n); void g(int a, int b) { if (f(a) == 2) f(b); } gcc says nothing $ g++ -c -O2 -Wall -Wextra -ansi -pedantic mar26b.cc clang has more to say $ clang++ -c !$ clang++ -c mar26b.cc mar26b.cc:7:11: warning: comparison of constant 2 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare] if (f(a) == 2) ~~~~ ^ ~ 1 warning generated. I've just built gcc trunk with clang and it looks as if producing a similar warning to clang will flush out five bugs in gcc trunk.