re PR c++/82468 (ICE with deduction guide template)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 16 Feb 2018 15:34:58 +0000 (15:34 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 16 Feb 2018 15:34:58 +0000 (15:34 +0000)
/cp
2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82468
* decl.c (check_special_function_return_type): Reject template
template parameter in deduction guide.

/testsuite
2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82468
* g++.dg/cpp1z/class-deduction48.C: New.

From-SVN: r257740

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/class-deduction48.C [new file with mode: 0644]

index ee3ade9bd050845910d6673ec9927ef2965bcbf9..1da0a4d4a53d2d74ad417bb86175551091ab912d 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/82468
+       * decl.c (check_special_function_return_type): Reject template
+       template parameter in deduction guide.
+
 2018-02-16  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/84375
index 3ccea9e6a4506d530eaf4ba48494f68edf40a128..fbcc778f0cc23c490b50a4c588306c39964b8060 100644 (file)
@@ -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],
index 58eb38582d918ef8e371381ce3c01d03e4a46539..068f169ed6d2cd1deda08b3ac3e8726058380a3f 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/82468
+       * g++.dg/cpp1z/class-deduction48.C: New.
+
 2018-02-16  Nathan Sidwell  <nathan@acm.org>
 
        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 (file)
index 0000000..1cfdc44
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/82468
+// { dg-options -std=c++17 }
+
+template <template <class> class TT>
+TT(double) -> TT<int>;  // { dg-error "template template" }