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++/102479] segfault when deducing class template arguments for tuple with libc++-14 Date: Mon, 27 Sep 2021 20:03:39 +0000 [thread overview] Message-ID: <bug-102479-4-k6IloE151N@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102479-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102479 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:51018dd1395c72b3681ae5f84eceb94320472922 commit r12-3906-g51018dd1395c72b3681ae5f84eceb94320472922 Author: Patrick Palka <ppalka@redhat.com> Date: Mon Sep 27 16:01:10 2021 -0400 c++: deduction guides and ttp rewriting [PR102479] The problem here is ultimately that rewrite_tparm_list when rewriting a TEMPLATE_TEMPLATE_PARM introduces a tree cycle in the rewritten ttp that structural_comptypes can't cope with. In particular the DECL_TEMPLATE_PARMS of a ttp's TEMPLATE_DECL normally captures an empty parameter list at its own level (and so the TEMPLATE_DECL doesn't appear in its own DECL_TEMPLATE_PARMS), but rewrite_tparm_list ends up giving it a complete parameter list. In the new testcase below, this causes infinite recursion from structural_comptypes when comparing Tmpl<char> with Tmpl<long> (where both 'Tmpl's are rewritten ttps). This patch fixes this by making rewrite_template_parm give a rewritten template template parm an empty parameter list at its own level, thereby avoiding the tree cycle. Testing the alias CTAD case revealed that we're not setting current_template_parms in alias_ctad_tweaks, which this patch also fixes. PR c++/102479 gcc/cp/ChangeLog: * pt.c (rewrite_template_parm): Handle single-level tsubst_args. Avoid a tree cycle when assigning the DECL_TEMPLATE_PARMS for a rewritten ttp. (alias_ctad_tweaks): Set current_template_parms accordingly. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction12.C: Also test alias CTAD in the same way. * g++.dg/cpp1z/class-deduction99.C: New test.
next prev parent reply other threads:[~2021-09-27 20:03 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-24 21:37 [Bug c++/102479] New: " root.main at gmail dot com 2021-09-24 21:38 ` [Bug c++/102479] " root.main at gmail dot com 2021-09-27 13:59 ` ppalka at gcc dot gnu.org 2021-09-27 20:03 ` cvs-commit at gcc dot gnu.org [this message] 2021-11-03 18:59 ` ppalka at gcc dot gnu.org 2021-12-20 19:06 ` ppalka at gcc dot gnu.org 2022-02-03 9:17 ` pinskia at gcc dot gnu.org 2022-03-29 15:09 ` mpolacek at gcc dot gnu.org 2022-05-13 13:02 ` jason at gcc dot gnu.org 2022-05-13 13:40 ` cvs-commit at gcc dot gnu.org 2022-05-13 13:45 ` 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-102479-4-k6IloE151N@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).