From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7CFF2385841E; Wed, 22 Sep 2021 15:18:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CFF2385841E From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102412] Template argument deduction fails when using concept as defaulted non-type template parameter Date: Wed, 22 Sep 2021 15:18:11 +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: 12.0 X-Bugzilla-Keywords: rejects-valid 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: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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: Wed, 22 Sep 2021 15:18:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102412 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:9329344a6d81a6a5e3bd171167ebc7b158bb44f4 commit r12-3822-g9329344a6d81a6a5e3bd171167ebc7b158bb44f4 Author: Patrick Palka Date: Wed Sep 22 11:16:53 2021 -0400 c++: concept-ids and value-dependence [PR102412] The problem here is that uses_template_parms returns true for all concept-ids (even those with non-dependent arguments), so when a concep= t-id is used as a default template argument then during deduction the default argument is considered dependent even after substituting into it, which leads to deduction failure (from type_unification_real). This patch fixes this by implementing the resolution of CWG 2446 which says a concept-id is dependent only if its arguments are. DR 2446 PR c++/102412 gcc/cp/ChangeLog: * constexpr.c (cxx_eval_constant_expression) : Check value_dependent_expression_p instead of processing_template_decl. * pt.c (value_dependent_expression_p) : Return true only if any_dependent_template_arguments_p. (instantiation_dependent_r) : Remove this case. : Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-nondep2.C: New test. * g++.dg/cpp2a/concepts-nondep3.C: New test.=