public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94553] Revisit [basic.scope.declarative]/4.2
Date: Fri, 10 Apr 2020 23:18:55 +0000	[thread overview]
Message-ID: <bug-94553-4-ObIVtc7rNW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94553-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
To fix CWG 2289, we need this:

--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1705,6 +1705,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool
newdecl_is_friend)
      inform (olddecl_loc, "previous declaration %q#D", olddecl);
      return error_mark_node;
    }
+      else if ((VAR_P (olddecl) && DECL_DECOMPOSITION_P (olddecl))
+          || (VAR_P (newdecl) && DECL_DECOMPOSITION_P (newdecl)))
+   /* A structured binding must be unique in its declarative region.  */;
       else if (DECL_IMPLICIT_TYPEDEF_P (olddecl)
           || DECL_IMPLICIT_TYPEDEF_P (newdecl))
    /* One is an implicit typedef, that's ok.  */


but that's not enough to detect the 'A' case:
cp_parser_decomposition_declaration
uses

13968       tree decl2 = start_decl (declarator, &decl_specs, SD_INITIALIZED,
13969                                NULL_TREE, NULL_TREE, &elt_pushed_scope);

to create the 'A' VAR_DECL but in this start_decl's grokdeclarator we don't do
fit_decomposition_lang_decl because the declarator kind is not cdk_decomp, so
then when start_decl calls maybe_push_decl, the decl 'A' isn't
DECL_DECOMPOSITION_P and we don't detect this case.  So we need a way to signal
to start_decl that it should fit_decomposition_lang_decl.

  parent reply	other threads:[~2020-04-10 23:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 18:11 [Bug c++/94553] New: " mpolacek at gcc dot gnu.org
2020-04-10 18:12 ` [Bug c++/94553] " mpolacek at gcc dot gnu.org
2020-04-10 23:18 ` mpolacek at gcc dot gnu.org [this message]
2020-05-13 16:23 ` [Bug c++/94553] Revise [basic.scope.declarative]/4.2 mpolacek at gcc dot gnu.org
2020-05-20 17:39 ` cvs-commit at gcc dot gnu.org
2020-05-20 17:41 ` mpolacek at gcc dot gnu.org
2020-06-26 16:07 ` mpolacek at gcc dot gnu.org
2020-06-29 15:02 ` cvs-commit at gcc dot gnu.org
2020-06-29 15:11 ` mpolacek 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-94553-4-ObIVtc7rNW@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).