From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D52783857B98; Tue, 11 Jul 2023 14:06:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D52783857B98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689084384; bh=i6Kn2RTQmTyOIDeFvOTjXarEMxjrRb0+m197Ha7A7Zs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gFg/EfmOmdZSsUCsaf1Y09sMhG75Gd1JIx7VOooaQtPI8Ye49KkTpj2TELon35hpo 7WZDBa8SH8WoY2veF+cRP5PQQv2m81op47aamY7y+RbRdlHsj9NtqD6EnsoAGw/Q7m TWKXfZzMMv+Sob5ZxJAmTFGR6nROghB8hhF/adFk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110580] [14 Regression] gcc fails to typecheck nix-2.16.1 source: error: invalid initialization of reference of type Date: Tue, 11 Jul 2023 14:06:24 +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: 14.0 X-Bugzilla-Keywords: accepts-invalid, rejects-valid, wrong-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: 14.0 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=3D110580 --- Comment #8 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:b76d71564925abcabe6f5ad61d904b23c682cdfb commit r14-2433-gb76d71564925abcabe6f5ad61d904b23c682cdfb Author: Patrick Palka Date: Tue Jul 11 10:05:19 2023 -0400 c++: coercing variable template from current inst [PR110580] Here during ahead of time coercion of the variable template-id v1, since we pass only the innermost arguments to coerce_template_parms (and outer arguments are still dependent at this point), substitution of the default template argument V=3DU just lowers U from level 2 to level 1 r= ather than replacing it with int as expected. Thus after coercion we incorre= ctly end up with (effectively) v1 instead of v1. Coercion of a class/alias template-id on the other hand always passes all levels arguments, which avoids this issue. So this patch makes us do the same for variable template-ids. PR c++/110580 gcc/cp/ChangeLog: * pt.cc (lookup_template_variable): Pass all levels of arguments to coerce_template_parms, and use the parameters from the most general template. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ83.C: New test.=