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++/94553] Revise [basic.scope.declarative]/4.2 Date: Mon, 29 Jun 2020 15:02:31 +0000 [thread overview] Message-ID: <bug-94553-4-LX52LpBpgg@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 #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:54980635c537f3130481da2d8b1109c775db8bb0 commit r11-1714-g54980635c537f3130481da2d8b1109c775db8bb0 Author: Marek Polacek <polacek@redhat.com> Date: Fri Jun 26 12:40:59 2020 -0400 c++: Check uniqueness of concepts/variable templates [PR94553] This patch wraps up PR94553. Variable template names have no C compatibility implications so they should be unique in their declarative region. It occurred to me that this applies to concepts as well. This is not specified in [basic.scope.declarative]/4.2 but that seems like a bug in the standard. I couldn't use variable_template_p because that uses PRIMARY_TEMPLATE_P which uses DECL_PRIMARY_TEMPLATE and that might not have been set up yet (push_template_decl hasn't yet been called). PRIMARY_TEMPLATE_P is important to distinguish between a variable template and a variable in a function template. But I think we don't have to worry about that in duplicate_decls: a template declaration cannot appear at block scope, and additional checks in duplicate_decls suggest that it won't ever see a TEMPLATE_DECL for a variable in a function template. So checking that the DECL_TEMPLATE_RESULT is a VAR_DECL seems to be fine. I could have added a default argument to variable_template_p too to avoid checking PRIMARY_TEMPLATE_P but it didn't seem worth the effort. gcc/cp/ChangeLog: PR c++/94553 * decl.c (duplicate_decls): Make sure a concept or a variable template is unique in its declarative region. gcc/testsuite/ChangeLog: PR c++/94553 * g++.dg/cpp1y/pr68578.C: Adjust dg-error. * g++.dg/cpp1y/var-templ66.C: New test. * g++.dg/cpp2a/concepts-redecl1.C: New test.
next prev parent reply other threads:[~2020-06-29 15:02 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-10 18:11 [Bug c++/94553] New: Revisit [basic.scope.declarative]/4.2 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 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 [this message] 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-LX52LpBpgg@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: linkBe 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).