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++/100138] ICE with constructor constrained (C++20 Concepts) by parameter pack length
Date: Tue, 11 May 2021 02:39:39 +0000	[thread overview]
Message-ID: <bug-100138-4-n8g9qoUaII@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100138-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100138

--- 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:e7a9f085ffd34b0d7bc4b803c182b41494f609aa

commit r12-701-ge7a9f085ffd34b0d7bc4b803c182b41494f609aa
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 10 22:33:04 2021 -0400

    c++: fn parm pack expansion inside constraint [PR100138]

    This PR is about CTAD but the underlying problems are more general;
    CTAD is a good trigger for them because of the necessary substitution
    into constraints that deduction guide generation entails.

    In the testcase below, when generating the implicit deduction guide for
    the constrained constructor template for A, we substitute the generic
    flattening map 'tsubst_args' into the constructor's constraints.  During
    this substitution, tsubst_pack_expansion returns a rebuilt pack
    expansion for sizeof...(xs), but doesn't carry over the
    PACK_EXPANSION_LOCAL_P (and PACK_EXPANSION_SIZEOF_P) flag from the
    original tree to the rebuilt one.  The flag is otherwise unset on the
    original tree but gets set for the rebuilt tree from make_pack_expansion
    since at_function_scope_p() is true (we're inside main).  This leads to
    a crash during satisfaction when substituting into the pack expansion
    because we don't have local_specializations set up (and it'd be set up
    for us if PACK_EXPANSION_LOCAL_P is unset)

    Similarly, tsubst_constraint needs to set cp_unevaluated so that the
    substitution performed therein doesn't rely on local_specializations.
    This avoids a crash during CTAD for C below.

    gcc/cp/ChangeLog:

            PR c++/100138
            * constraint.cc (tsubst_constraint): Set up cp_unevaluated.
            (satisfy_atom): Set up iloc_sentinel before calling
            cxx_constant_value.
            * pt.c (tsubst_pack_expansion): When returning a rebuilt pack
            expansion, carry over PACK_EXPANSION_LOCAL_P and
            PACK_EXPANSION_SIZEOF_P from the original pack expansion.

    gcc/testsuite/ChangeLog:

            PR c++/100138
            * g++.dg/cpp2a/concepts-ctad4.C: New test.

  parent reply	other threads:[~2021-05-11  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 23:00 [Bug c++/100138] New: " pkeir at outlook dot com
2021-04-19  2:07 ` [Bug c++/100138] " ppalka at gcc dot gnu.org
2021-05-06 15:37 ` ppalka at gcc dot gnu.org
2021-05-11  2:39 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-16 22:49 ` cvs-commit at gcc dot gnu.org
2021-07-16 22:51 ` 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-100138-4-n8g9qoUaII@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: link
Be 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).