From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C70438930DE; Mon, 29 Jun 2020 15:02:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C70438930DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593442952; bh=Q3B7Ls4Vazn9980qrACsPrXzatSXGS9sTZW0uabAlF0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FGZzGU93hVwgWVh4IuoYmOS0+gp/6uY/9GFbpyPrOC6GcUgVRyJHXpORn/XeWOPsj ocSMUBLbs2Ss5vYaXRklar5dmmJjVgPSLvLkqNK1aa56t/jol9+Kf9TZTQbO7khoOp YcjdU85bcivpoDC1A8+cORHA3SxEUo56LQBfT5Jc= From: "cvs-commit at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 15:02:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94553 --- Comment #7 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:54980635c537f3130481da2d8b1109c775db8bb0 commit r11-1714-g54980635c537f3130481da2d8b1109c775db8bb0 Author: Marek Polacek 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.=