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>
Fri, 29 Apr 2022 21:24:27 +0000 (17:24 -0400)
commit4259c229b457361a9b5cdec157e058bf0c2c8b77
treeb5b991c4bb1f2021423c93d57b8dbed42fdb5b27
parent53e7252140c95afc859ade521a61ab4115d7fb11
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