public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109651] [13 Regression] ICE in lookup_template_class since r14-11-g2245459c85a3f4 Date: Fri, 12 May 2023 15:07:51 +0000 [thread overview] Message-ID: <bug-109651-4-tWFGmMmXRd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109651-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109651 --- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:986e38bcb0368a884fb4ea16159dd852406af078 commit r13-7322-g986e38bcb0368a884fb4ea16159dd852406af078 Author: Patrick Palka <ppalka@redhat.com> Date: Sun May 7 11:54:21 2023 -0400 c++: bound ttp in lambda function type [PR109651] After r14-11-g2245459c85a3f4 we now coerce the template arguments of a bound ttp again after level-lowering it. Notably a level-lowered ttp doesn't have DECL_CONTEXT set, so during this coercion we fall back to using current_template_parms to obtain the relevant set of in-scope parameters. But it turns out current_template_parms isn't properly set when substituting the function type of a generic lambda, and so if the type contains bound ttps that need to be lowered we'll crash during their attempted coercion. Specifically in the first testcase below, current_template_parms during the lambda type substitution (with T=int) is "1 U" instead of the expected "2 TT, 1 U", and we crash when level lowering TT<int>. Ultimately the problem is that tsubst_lambda_expr does things in the wrong order: we ought to substitute (and install) the in-scope template parameters _before_ substituting anything that may use those template parameters (such as the function type of a generic lambda). This patch corrects this substitution order. PR c++/109651 gcc/cp/ChangeLog: * pt.cc (coerce_template_args_for_ttp): Mention we can hit the current_template_parms fallback when level-lowering a bound ttp. (tsubst_template_decl): Add lambda_tparms parameter. Prefer to use lambda_tparms instead of substituting DECL_TEMPLATE_PARMS. (tsubst_decl) <case TEMPLATE_DECL>: Pass NULL_TREE as lambda_tparms to tsubst_template_decl. (tsubst_lambda_expr): For a generic lambda, substitute DECL_TEMPLATE_PARMS and set current_template_parms to it before substituting the function type. Pass the substituted DECL_TEMPLATE_PARMS as lambda_tparms to tsubst_template_decl. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-generic-ttp1.C: New test. * g++.dg/cpp2a/lambda-generic-ttp2.C: New test. (cherry picked from commit 7bfb1550ccea7c426d50244e980f01f30db8ba0c)
next prev parent reply other threads:[~2023-05-12 15:07 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-27 17:13 [Bug c++/109651] New: ICE in lookup_template_class jeanmichael.celerier at gmail dot com 2023-04-27 17:20 ` [Bug c++/109651] " mpolacek at gcc dot gnu.org 2023-04-27 17:23 ` pinskia at gcc dot gnu.org 2023-04-27 17:51 ` jeanmichael.celerier at gmail dot com 2023-04-27 18:00 ` mpolacek at gcc dot gnu.org 2023-04-27 18:25 ` [Bug c++/109651] [13/14 Regression] " mpolacek at gcc dot gnu.org 2023-04-27 18:31 ` ppalka at gcc dot gnu.org 2023-04-28 6:25 ` rguenth at gcc dot gnu.org 2023-04-28 20:37 ` ppalka at gcc dot gnu.org 2023-05-07 15:54 ` [Bug c++/109651] [13/14 Regression] ICE in lookup_template_class since r14-11-g2245459c85a3f4 cvs-commit at gcc dot gnu.org 2023-05-07 15:55 ` [Bug c++/109651] [13 " ppalka at gcc dot gnu.org 2023-05-12 15:07 ` cvs-commit at gcc dot gnu.org [this message] 2023-05-12 15:22 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109651-4-tWFGmMmXRd@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).