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.