[Bug c++/94265] wrong warning "duplicated 'if' condition"
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 25 16:35:45 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94265
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:c7a252ba2d0a08397d8fc6d6dc7db34f90f76acb
commit r10-7379-gc7a252ba2d0a08397d8fc6d6dc7db34f90f76acb
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Mar 25 12:32:43 2020 -0400
c++: Fix invalid -Wduplicated-cond warning [PR94265]
This fixes a false-positive warning from -Wduplicate-cond in the presence
of an
if-statement with a non-empty init-statement. Precisely determining
whether a
non-empty init-statement has side effects seems tricky and error-prone, so
this
patch takes the route of unconditionally invalidating the condition chain
when
it encounters such an if-statement.
gcc/cp/ChangeLog:
PR c++/94265
* parser.c (cp_parser_selection_statement) <case RID_IF>:
Invalidate the
current condition chain when the if-statement has a non-empty
init-statement.
gcc/testsuite/ChangeLog:
PR c++/94265
* g++.dg/warn/Wduplicated-cond1.C: New test.
More information about the Gcc-bugs
mailing list