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++/114903] constraint of CTAD alias deduction guide is evaluated on a wrong type
Date: Mon, 13 May 2024 13:53:58 +0000	[thread overview]
Message-ID: <bug-114903-4-t4yDrQrjMq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114903-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from GCC 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:6d31a370e26eeb950c326332633b3e8e84b6630b

commit r15-434-g6d31a370e26eeb950c326332633b3e8e84b6630b
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 13 09:53:40 2024 -0400

    c++: nested aggregate/alias CTAD fixes [PR114974, PR114901, PR114903]

    During maybe_aggr_guide with a nested class template and paren init,
    like with list init we need to consider the generic template type rather
    than the partially instantiated type since partial instantiations don't
    have (partially instantiated) TYPE_FIELDS.  In turn we need to partially
    substitute PARMs in the paren init case as well.  As a drive-by improvement
    it seems better to use outer_template_args instead of DECL_TI_ARGS during
    this partial substitution so that we lower instead of substitute the
    innermost template parameters, which is generally more robust.

    And during alias_ctad_tweaks with a nested class template, even though
    the guides may be already partially instantiated we still need to
    substitute the outermost arguments into its constraints.

            PR c++/114974
            PR c++/114901
            PR c++/114903

    gcc/cp/ChangeLog:

            * pt.cc (maybe_aggr_guide): Fix obtaining TYPE_FIELDS in
            the paren init case.  Hoist out partial substitution logic
            to apply to the paren init case as well.
            (alias_ctad_tweaks): Substitute outer template arguments into
            a guide's constraints.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/class-deduction-aggr14.C: New test.
            * g++.dg/cpp2a/class-deduction-alias20.C: New test.
            * g++.dg/cpp2a/class-deduction-alias21.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>

  reply	other threads:[~2024-05-13 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01  8:06 [Bug c++/114903] New: " hokein.wu at gmail dot com
2024-05-13 13:53 ` cvs-commit at gcc dot gnu.org [this message]
2024-05-13 15:39 ` [Bug c++/114903] " cvs-commit at gcc dot gnu.org
2024-05-13 15:41 ` 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-114903-4-t4yDrQrjMq@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).