c++: fix alias CTAD [PR105841]
commit9e6170098d5e7756e85e880f8f4cb18e885a64fd
authorJason Merrill <jason@redhat.com>
Thu, 9 Feb 2023 06:06:22 +0000 (8 22:06 -0800)
committerJason Merrill <jason@redhat.com>
Thu, 9 Mar 2023 15:25:46 +0000 (9 10:25 -0500)
tree02286e11adeedcb94780fb611027d9cad43b2371
parent30556bf81f4385c2a9c449948865dbcf35664764
c++: fix alias CTAD [PR105841]

In my initial implementation of alias CTAD, I described a couple of
differences from the specification that I thought would not have a practical
effect; this testcase demonstrates that I was wrong.  One difference is
resolved by the CPTK_IS_DEDUCIBLE commit; the other (adding too many of the
alias template parameters to the new deduction guide) is fixed by this
patch.

PR c++/105841

gcc/cp/ChangeLog:

* pt.cc (corresponding_template_parameter_list): Split out...
(corresponding_template_parameter): ...from here.
(find_template_parameters): Factor out...
(find_template_parameter_info::find_in): ...this function.
(find_template_parameter_info::find_in_recursive): New.
(find_template_parameter_info::found): New.
(alias_ctad_tweaks): Only add parms used in the deduced args.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-alias14.C: New test.

Co-authored-by: Michael Spertus <mike@spertus.com>
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias14.C [new file with mode: 0644]