]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/85147 (ICE with invalid variadic template-template parameter)
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 21:04:25 +0000 (23:04 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 21:04:25 +0000 (23:04 +0200)
Backported from mainline
2018-04-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/85147
* pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.

* g++.dg/cpp0x/pr85147.C: New test.

From-SVN: r261945

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr85147.C [new file with mode: 0644]

index b21322cb549490b3ad8d10ee4247d8b0e84ff4de..062384e41156e16a3f141b7641c10f05dfdb03cd 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-04-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/85147
+       * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
+
        PR c++/85140
        * name-lookup.c (handle_namespace_attrs): Return early if attributes
        is error_mark_node.
index b9189d3fe9340d597e41592b0b1a34ea9dcc7f8f..5e79bc90af5dc41f89b195bf5bb648a309ab9f79 100644 (file)
@@ -4864,7 +4864,7 @@ static void
 fixed_parameter_pack_p_1 (tree parm, struct find_parameter_pack_data *ppd)
 {
   /* A type parm can't refer to another parm.  */
-  if (TREE_CODE (parm) == TYPE_DECL)
+  if (TREE_CODE (parm) == TYPE_DECL || parm == error_mark_node)
     return;
   else if (TREE_CODE (parm) == PARM_DECL)
     {
index e7fbda1082aeec4dc53caee0437c49e997507c62..84abc4f8e37e877cf504e8b0675a91817d48b2e4 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-04-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/85147
+       * g++.dg/cpp0x/pr85147.C: New test.
+
        PR c++/85140
        * g++.dg/cpp0x/gen-attrs-64.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85147.C b/gcc/testsuite/g++.dg/cpp0x/pr85147.C
new file mode 100644 (file)
index 0000000..68c0022
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/85147
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct A
+{
+  template<template<...T> class...> struct B {};       // { dg-error "expected|mismatch" }
+};
+
+A<int>::B<> b;                                         // { dg-error "does not name a template type" }