From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3759B3858281; Sat, 1 Apr 2023 16:02:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3759B3858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680364921; bh=A+shxWGymoH8P95e8sR8HcxslTBdujGyXp2EhvBIaV8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yfMWOt2GNb1c5UlguVJOdOVGdJIN+gqqirXWjqAuXQ3XJTTmduWvLtKhXbKkKU0bq RBZAQPatIYVrVdDwLcr+UtyUpbnK1JReVGmAcbLouoL62GQqZqcQ1MIcf/PG0U4CGs o+ezVBUFfQqN2g0DYcXvYBYYbB8mXhH7FRAIrZPw= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109160] [Valid code] Constraint on deduced NTTP from method call causes ICE/Segfault. Date: Sat, 01 Apr 2023 16:01:58 +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.1.0 X-Bugzilla-Keywords: ice-on-valid-code 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: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109160 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:a5de246535db1b4fdc61287f27de0fdd074fc4b3 commit r13-6971-ga5de246535db1b4fdc61287f27de0fdd074fc4b3 Author: Patrick Palka Date: Sat Apr 1 12:01:30 2023 -0400 c++: NTTP constraint depending on outer parms [PR109160] Here we're crashing during satisfaction for the NTTP 'C auto V' ultimately because convert_template_argument / unify don't pass all outer template arguments to do_auto_deduction, and during satisfaction we need to know all arguments. While these callers do pass some outer arguments, they are only sufficient to properly substitute the (level-lowered) 'auto' and are not necessarily the entire set. Fortunately it seems these callers have access to the full set of outer arguments via convert_template_argument's 'in_decl' parameter and unify's 'tparms' parameter. So this patch adds a new parameter to do_auto_deduction, used only during adc_unify deduction, through which these callers can pass the enclosing (partially instantiated) template and from which do_auto_deduction can obtain _all_ outer template arguments for sake of satisfaction. This patch also ensures that the 'in_decl' argument passed to coerce_template_parms is always a TEMPLATE_DECL, which in turn allows us to pass it as-is to do_auto_deduction; the only coerce_template_parms caller that needed adjustment was tsubst_decl it seems. PR c++/109160 gcc/cp/ChangeLog: * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter. * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to do_auto_deduction. (tsubst_decl) : Pass 'tmpl' instead of 't'= as 'in_decl' to coerce_template_parms. (unify) : Pass TPARMS_PRIMARY_TEMPLATE as 'tmpl' to do_auto_deduction. (do_auto_deduction): Document default arguments. Rename local variable 'tmpl' to 'ctmpl'. Use 'tmpl' to obtain a full set of template arguments for satisfaction in the adc_unify case. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-placeholder12.C: New test.=