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++/109160] [Valid code] Constraint on deduced NTTP from method call causes ICE/Segfault.
Date: Tue, 09 May 2023 12:57:35 +0000	[thread overview]
Message-ID: <bug-109160-4-hMJMnsQIuU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109160-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:56da68414b5b5f0124cac29756c88710e5752762

commit r12-9525-g56da68414b5b5f0124cac29756c88710e5752762
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Apr 1 12:01:30 2023 -0400

    c++: NTTP constraint depending on outer parms [PR109160]

    Here we're crashing during satisfaction for the NTTP 'C<B> auto V'
    ultimately because convert_template_argument / unify don't pass all
    outer template arguments to do_auto_deduction, and during satisfaction
    we need to know all arguments.  While these callers do pass some outer
    arguments, they are only sufficient to properly substitute the
    (level-lowered) 'auto' and are not necessarily the entire set.

    Fortunately it seems these callers have access to the full set of outer
    arguments via convert_template_argument's 'in_decl' parameter and
    unify's 'tparms' parameter.  So this patch adds a new parameter to
    do_auto_deduction, used only during adc_unify deduction, through which
    these callers can pass the enclosing (partially instantiated) template
    and from which do_auto_deduction can obtain _all_ outer template
    arguments for sake of satisfaction.

    This patch also ensures that the 'in_decl' argument passed to
    coerce_template_parms is always a TEMPLATE_DECL, which in turn allows us
    to pass it as-is to do_auto_deduction; the only coerce_template_parms
    caller that needed adjustment was tsubst_decl it seems.

            PR c++/109160

    gcc/cp/ChangeLog:

            * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter.
            * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to
            do_auto_deduction.
            (tsubst_decl) <case VAR_/TYPE_DECL>: Pass 'tmpl' instead of 't' as
            'in_decl' to coerce_template_parms.
            (unify) <case TEMPLATE_PARM_INDEX>: Pass TPARMS_PRIMARY_TEMPLATE
            as 'tmpl' to do_auto_deduction.
            (do_auto_deduction): Document default arguments.  Rename local
            variable 'tmpl' to 'ctmpl'.  Use 'tmpl' to obtain a full set of
            template arguments for satisfaction in the adc_unify case.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-placeholder12.C: New test.

    (cherry picked from commit a5de246535db1b4fdc61287f27de0fdd074fc4b3)

  parent reply	other threads:[~2023-05-09 12:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 20:15 [Bug c++/109160] New: " vincent_saulue at hotmail dot fr
2023-03-17 14:23 ` [Bug c++/109160] " ppalka at gcc dot gnu.org
2023-04-01 16:01 ` cvs-commit at gcc dot gnu.org
2023-04-01 16:02 ` ppalka at gcc dot gnu.org
2023-04-01 16:02 ` ppalka at gcc dot gnu.org
2023-04-14 13:33 ` vincent_saulue at hotmail dot fr
2023-05-08 12:26 ` rguenth at gcc dot gnu.org
2023-05-09 12:57 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-09 12:58 ` 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-109160-4-hMJMnsQIuU@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).