This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/63519] missing Wparenthesis warning for x binary_op bool ?:


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-08-25
                 CC|                            |egallager at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
g++ now prints a warning from -Wint-in-bool-context for it:

$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic 63519.cc
63519.cc: In function ‘int foo(bool, int, int, int)’:
63519.cc:3:11: warning: ‘*’ in boolean context, suggest ‘&&’ instead
[-Wint-in-bool-context]
  return x * a ? y : z;
         ~~^~~
$

Confirming that a warning from -Wparentheses is still missing though. Also the
-Wint-in-bool-context one could do better and add a fix-it hint, seeing as it
already has a suggestion in the message.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]