public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94265] wrong warning "duplicated 'if' condition"
Date: Wed, 25 Mar 2020 16:35:45 +0000	[thread overview]
Message-ID: <bug-94265-4-V0m8tnqe2o@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94265-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2020-03-25 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  0:38 [Bug c++/94265] New: " f.heckenbach@fh-soft.de
2020-03-23  8:05 ` [Bug c++/94265] " marxin at gcc dot gnu.org
2020-03-24 17:18 ` ppalka at gcc dot gnu.org
2020-03-25 16:35 ` cvs-commit at gcc dot gnu.org [this message]
2020-03-25 16:37 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94265-4-V0m8tnqe2o@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).