aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-03-25 12:32:43 -0400
committerPatrick Palka <ppalka@redhat.com>2020-03-25 12:33:12 -0400
commitc7a252ba2d0a08397d8fc6d6dc7db34f90f76acb (patch)
tree7e34c9ee867c9b4b8a85e029608cd0bd476c87f6 /gcc/tree.c
parent05c13c439903eb78f109bcab62fd9a74f03a3c9b (diff)
downloadgcc-c7a252ba2d0a08397d8fc6d6dc7db34f90f76acb.zip
gcc-c7a252ba2d0a08397d8fc6d6dc7db34f90f76acb.tar.gz
gcc-c7a252ba2d0a08397d8fc6d6dc7db34f90f76acb.tar.bz2
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.
Diffstat (limited to 'gcc/tree.c')
0 files changed, 0 insertions, 0 deletions