Implement P0091R2, Template argument deduction for class templates.
authorJason Merrill <jason@redhat.com>
Tue, 4 Oct 2016 20:42:58 +0000 (16:42 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 4 Oct 2016 20:42:58 +0000 (16:42 -0400)
commit76b294d48d6c375b76f1695ea56c960d5473439b
tree0984f230491f3ffe8ce6006150b0dcd48d966e4b
parent8ff04ff92d9d88ca84671e36600572558216eab2
Implement P0091R2, Template argument deduction for class templates.

* parser.c (cp_parser_simple_type_specifier): Parse class placeholder.
Use the location of the beginning of the type-specifier.
(cp_parser_init_declarator): Parse deduction guide.
(cp_parser_diagnose_invalid_type_name): Mention class deduction.
(cp_parser_type_id_1): Don't accept class placeholder as template arg.
* cp-tree.h (CLASS_PLACEHOLDER_TEMPLATE): New.
* decl.c (grokdeclarator): Check for uninitialized auto here.
(start_decl_1): Not here.
(cp_finish_decl): Or here.  Don't collapse a list when doing
class deduction.
(grokfndecl): Check deduction guide scope and body.
* error.c (dump_decl, dump_function_decl, dump_function_name):
Handle deduction guides.
* pt.c (make_template_placeholder, do_class_deduction): New.
(build_deduction_guide, rewrite_template_parm): New.
(dguide_name, dguide_name_p, deduction_guide_p): New.
(do_auto_deduction): Call do_class_deduction.
(splice_late_return_type, is_auto): Handle class placeholders.
(template_parms_level_to_args): Split from template_parms_to_args.
(tsubst_template_parms_level): Split from tsubst_template_parms.
* typeck2.c (build_functional_cast): Handle class placeholder.

From-SVN: r240756
27 files changed:
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/typeck2.c
gcc/testsuite/g++.dg/concepts/class-deduction1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/concepts/var-concept5.C
gcc/testsuite/g++.dg/cpp1z/class-deduction1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction13.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/class-deduction9.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/access10.C
gcc/testsuite/g++.dg/parse/decl-specifier-1.C
gcc/testsuite/g++.dg/parse/template2.C
gcc/testsuite/g++.old-deja/g++.robertl/eb129.C
gcc/testsuite/g++.old-deja/g++.robertl/eb129a.C