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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to jos...@codesourcery.com from comment #2)
> following is not suspicious and it would seem silly to warn for it:
> 
> return (a > 0 && b <= 3 ? 1 : 2);
> 
> (because the suggested alternative parse would involve b <= 3 ? 1 : 2 as 
> RHS of &&, which is unnatural as a conditional expression in boolean 
> context where the halves of the expression aren't boolean).

While there is only one sensible parsing, in a code review I would still ask
for parentheses, so that the reader can more quickly find that one sensible
parsing and be certain that the compiler agrees. But it becomes a matter of
style, and people complain every time we add a style warning, so maybe your
restricted warning would be best (easier to include in -Wall).

Reply via email to