From d65da12f2b93cea64a7122022208439cd282dfc2 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 16 Feb 2018 15:34:58 +0000 Subject: [PATCH] re PR c++/82468 (ICE with deduction guide template) /cp 2018-02-16 Paolo Carlini PR c++/82468 * decl.c (check_special_function_return_type): Reject template template parameter in deduction guide. /testsuite 2018-02-16 Paolo Carlini PR c++/82468 * g++.dg/cpp1z/class-deduction48.C: New. From-SVN: r257740 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 9 ++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1z/class-deduction48.C | 5 +++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction48.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee3ade9bd05..1da0a4d4a53 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-16 Paolo Carlini + + PR c++/82468 + * decl.c (check_special_function_return_type): Reject template + template parameter in deduction guide. + 2018-02-16 Nathan Sidwell PR c++/84375 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3ccea9e6a45..fbcc778f0cc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9834,7 +9834,14 @@ check_special_function_return_type (special_function_kind sfk, error_at (smallest_type_quals_location (type_quals, locations), "qualifiers are not allowed on declaration of " "deduction guide"); - type = make_template_placeholder (CLASSTYPE_TI_TEMPLATE (optype)); + if (TREE_CODE (optype) == TEMPLATE_TEMPLATE_PARM) + { + error ("template template parameter %qT in declaration of " + "deduction guide", optype); + type = error_mark_node; + } + else + type = make_template_placeholder (CLASSTYPE_TI_TEMPLATE (optype)); for (int i = 0; i < ds_last; ++i) if (i != ds_explicit && locations[i]) error_at (locations[i], diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58eb38582d9..068f169ed6d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-16 Paolo Carlini + + PR c++/82468 + * g++.dg/cpp1z/class-deduction48.C: New. + 2018-02-16 Nathan Sidwell PR c++/84375 diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction48.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction48.C new file mode 100644 index 00000000000..1cfdc44a993 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction48.C @@ -0,0 +1,5 @@ +// PR c++/82468 +// { dg-options -std=c++17 } + +template