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++/101764] ICE for constexpr if within fold expression within lambda expression within a template Date: Mon, 13 Sep 2021 14:31:54 +0000 [thread overview] Message-ID: <bug-101764-4-Cy7Xz96FHe@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101764-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101764 --- Comment #2 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:c8b2b89358481d36755dbc99e585a251780453b0 commit r12-3488-gc8b2b89358481d36755dbc99e585a251780453b0 Author: Patrick Palka <ppalka@redhat.com> Date: Mon Sep 13 10:29:32 2021 -0400 c++: parameter pack inside constexpr if [PR101764] Here when partially instantiating the first pack expansion, substitution into the condition of the constexpr if yields a still-dependent tree, so tsubst_expr returns an IF_STMT with an unsubstituted IF_COND and with IF_STMT_EXTRA_ARGS added to. Hence after partial instantiation the pack expansion pattern still refers to the unlowered parameter pack 'ts' of level 2, and it's thusly recorded in the new PACK_EXPANSION_PARAMETER_PACKS. During the subsequent final instantiation of the regenerated lambda we crash in tsubst_pack_expansion because it can't find an argument pack for this unlowered 'ts', due to the level mismatch. (Likewise when the constexpr if is replaced by a requires-expr, which also uses the extra args mechanism for avoiding partial instantiation.) So essentially, a pack expansion pattern that contains an "extra args" tree doesn't play well with partial instantiation. This patch fixes this by forcing such pack expansions to use the extra args mechanism as well. PR c++/101764 gcc/cp/ChangeLog: * cp-tree.h (PACK_EXPANSION_FORCE_EXTRA_ARGS_P): New accessor macro. * pt.c (has_extra_args_mechanism_p): New function. (find_parameter_pack_data::found_extra_args_tree_p): New data member. (find_parameter_packs_r): Set ppd->found_extra_args_tree_p appropriately. (make_pack_expansion): Set PACK_EXPANSION_FORCE_EXTRA_ARGS_P if ppd.found_extra_args_tree_p. (use_pack_expansion_extra_args_p): Return true if there were unsubstituted packs and PACK_EXPANSION_FORCE_EXTRA_ARGS_P. (tsubst_pack_expansion): Pass the pack expansion to use_pack_expansion_extra_args_p. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/constexpr-if35.C: New test.
next prev parent reply other threads:[~2021-09-13 14:31 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-03 18:57 [Bug c++/101764] New: " johelegp at gmail dot com 2021-08-13 19:39 ` [Bug c++/101764] " pinskia at gcc dot gnu.org 2021-08-20 13:50 ` ppalka at gcc dot gnu.org 2021-09-13 14:31 ` cvs-commit at gcc dot gnu.org [this message] 2021-09-13 14:59 ` ppalka at gcc dot gnu.org 2021-10-03 1:26 ` ppalka at gcc dot gnu.org 2021-11-02 19:56 ` ppalka at gcc dot gnu.org 2022-10-18 23:26 ` cvs-commit 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-101764-4-Cy7Xz96FHe@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).