diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-12-15 15:54:31 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-12-15 15:54:31 -0500 |
commit | be124477b38a71ba8ba0b24d859ae764bb44a4eb (patch) | |
tree | 75410ad2cd9d58aa08e91983acef4d5ba11f213c /gcc/rust/resolve | |
parent | 38304846d18d6bb14b0fd6c627c5c6d43a814d01 (diff) | |
download | gcc-be124477b38a71ba8ba0b24d859ae764bb44a4eb.zip gcc-be124477b38a71ba8ba0b24d859ae764bb44a4eb.tar.gz gcc-be124477b38a71ba8ba0b24d859ae764bb44a4eb.tar.bz2 |
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.
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions