From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E47A1385780A; Thu, 20 Jan 2022 14:26:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E47A1385780A From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103672] [10/11/12 Regression] using with template class> causes internal compiler error Date: Thu, 20 Jan 2022 14:26:17 +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: 11.2.1 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 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: Thu, 20 Jan 2022 14:26:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103672 --- Comment #3 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:09845ad7569bac27c3a1dc7b410d9df764d2ca06 commit r12-6773-g09845ad7569bac27c3a1dc7b410d9df764d2ca06 Author: Patrick Palka Date: Thu Jan 20 09:25:49 2022 -0500 c++: CTAD inside alias template [PR91911, PR103672] In the first testcase below, when processing the alias template ConstSpanType, transparency of alias template specializations means we replace SpanType with its instantiated definition. But this instantiation lowers the level of the CTAD placeholder for span{T()} fr= om 2 to 1, and so the later instantiation of ConstSpanType erroneously substitutes this CTAD placeholder with the template argument at level 1 index 0, i.e. with int, before we get a chance to perform the CTAD. Although we represent CTAD placeholders as template parameters, we never actually want to replace them via tsubst. So this patch adjusts tsubst to handle CTAD placeholders by simply substituting the template and returning a new CTAD placeholder. Moreover, this means that the level of a CTAD placeholder doesn't matter, so we may as well give them all the same level. This patch gives them the special level 0. The change in tsubst_decl removes a likely dead !CHECKING_P safeguard added in 2017, which would otherwise now get triggered for variables with CTAD placeholder types (since their level is 0). PR c++/91911 PR c++/103672 gcc/cp/ChangeLog: * pt.cc (keep_template_parm): Punt on a level 0 template parm. (tsubst_decl) : Remove !CHECKING_P safeguard. (tsubst) : Handle CTAD placeholders specially. (make_auto_1): Add defaulted 'level' parameter. (make_template_placeholder): Pass 0 as 'level' to make_auto_1. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction101.C: New test. * g++.dg/cpp1z/class-deduction101a.C: New test. * g++.dg/cpp1z/class-deduction101b.C: New test. * g++.dg/cpp1z/class-deduction102.C: New test. * g++.dg/cpp1z/class-deduction102a.C: New test. * g++.dg/cpp1z/class-deduction102b.C: New test. * g++.dg/cpp1z/class-deduction103.C: New test.=