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++/105518] [rejects valid] nested lambda using an outer type alias fails with constexpr integer in that alias
Date: Thu, 15 Dec 2022 20:54:43 +0000	[thread overview]
Message-ID: <bug-105518-4-7O43eKCpOJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105518-4@http.gcc.gnu.org/bugzilla/>

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

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

commit r13-4729-gbe124477b38a71ba8ba0b24d859ae764bb44a4eb
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Dec 15 15:54:31 2022 -0500

    c++: local alias in typename in lambda [PR105518]

    We substitute the qualifying scope of a TYPENAME_TYPE directly using
    tsubst_aggr_type (so that we can pass entering_scope=true) instead of
    going through tsubst, which means we don't properly reuse typedefs
    during this substitution.  This ends up causing us to reject the below
    testcase because we substitute the TYPENAME_TYPE alias::type as if it
    were written without the A<t> alias, and thus we expect the non-capturing
    lambda to capture t.

    This patch fixes this by making tsubst_aggr_type delegate typedefs
    to tsubst so that get consistently reused, and then adjusting the result
    appropriately if entering_scope is true.  In passing, this refactors
    tsubst_aggr_type into two functions, one that's intended to be called
    directly and a more minimal one that's intended to be called only from
    the RECORD/UNION/ENUMERAL_TYPE cases of tsubst (and contains only the
    necessary bits for that call site).

            PR c++/105518

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_aggr_type): Handle typedefs by delegating to
            tsubst and adjusting the result if entering_scope.  Split out
            the main part of the function into ...
            (tsubst_aggr_type_1) ... here.
            (tsubst): Use tsubst_aggr_type_1 instead of tsubst_aggr_type.
            Handle TYPE_PTRMEMFUNC_P RECORD_TYPEs here instead of in
            tsubst_aggr_type_1.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-alias1.C: New test.

  parent reply	other threads:[~2022-12-15 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 15:21 [Bug c++/105518] New: " leventyilmaz at gmail dot com
2022-11-01 23:02 ` [Bug c++/105518] " pinskia at gcc dot gnu.org
2022-12-15 20:54 ` cvs-commit at gcc dot gnu.org [this message]
2022-12-15 20:56 ` 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-105518-4-7O43eKCpOJ@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).