c++: alias CTAD and member alias templates [PR104470]
authorJason Merrill <jason@redhat.com>
Wed, 27 Apr 2022 15:13:24 +0000 (11:13 -0400)
committerJason Merrill <jason@redhat.com>
Sun, 15 May 2022 09:47:40 +0000 (05:47 -0400)
commit73b47159d7811cf1d7aaaf78dbdd141161b93ca3
treed0aecddf4d0f37dc79ed6e5da88b1f3d904fdb08
parent5237059e04d105fe5441fa7434699eea9a34bf1b
c++: alias CTAD and member alias templates [PR104470]

In this testcase, we were trying to substitute into
variant<Foo<T>>::__accepted_type, but failed to look it up because
variant<Foo<T>> doesn't exist.  In other cases we already rewrite such
things into a dependent reference; we need to do that for alias templates as
well.

This caused some testsuite regressions on alias uses outside of deduction
guides, so I've made all of this rewriting conditional on a new tf_dguide
tsubst flag.

PR c++/104470

gcc/cp/ChangeLog:

* cp-tree.h (enum tsubst_flags): Add tf_dguide.
* pt.cc (tsubst_aggr_type): Check it.
(tsubst_baselink, tsubst_copy): Check it.
(maybe_dependent_member_ref): Check it.
(instantiate_alias_template): Handle it.
(build_deduction_guide): Set it.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/explicit11.C: Second example also ill-formed.
* g++.dg/cpp2a/class-deduction-alias12.C: New test.
gcc/cp/cp-tree.h
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/explicit11.C