Implement P1814R0, CTAD for alias templates.
authorJason Merrill <jason@redhat.com>
Wed, 27 Nov 2019 22:05:53 +0000 (17:05 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 27 Nov 2019 22:05:53 +0000 (17:05 -0500)
commit1a291106384cabc73da0bc0f457b1cd3a4015970
tree3f4b4913ffbd60d6a8230235c945963f61958534
parent1f41df916c2d6d7598cb5e67cdaebdc86910e902
Implement P1814R0, CTAD for alias templates.

This patch implements C++20 class template argument deduction for alias
templates, which works by a moderately arcane transformation of the
deduction guides for the underlying class template.  When implementing it,
it seemed that I could simplify the rules in the draft a bit and get
essentially the same effect; I'll be emailing the committee to that effect
soon.

gcc/cp/
* pt.c (rewrite_tparm_list): Factor out of build_deduction_guide.
(maybe_aggr_guide): Check for copy-init here.
(alias_ctad_tweaks, deduction_guides_for): New.
(ctor_deduction_guides_for): Factor out of do_class_deduction.
(ctad_template_p): New.
* parser.c (cp_parser_simple_type_specifier): Use it.
* constraint.cc (append_constraint): New.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_deduction_guides.

From-SVN: r278786
14 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/constraint.cc
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp1z/class-deduction46.C
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/explicit11.C
gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C