https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111281

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The warning comes from the middle end, where the context of the conversion to
bool might have been lost. But the C++ front end already suppresses those
warnings in several places:

  /* This is a compiler generated comparison, don't emit
     e.g. -Wnonnull-compare warning for it.  */
  else if (TREE_CODE (ifexp) == NE_EXPR)
    suppress_warning (ifexp, OPT_Wnonnull_compare);

Maybe we want that when implicitly converting a function to bool, but then we
wouldn't get any warning at all. It does seem useful to warn about converting a
non-weak function to bool, because it's always true so why not just write
`true` instead. But maybe we want a C++ FE warning instead of the middle end
one.

Reply via email to