This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix error-recovery in fixed_parameter_pack_p_1 (PR c++/85147)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, Nathan Sidwell <nathan at acm dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 3 Apr 2018 18:06:43 +0200
- Subject: [C++ PATCH] Fix error-recovery in fixed_parameter_pack_p_1 (PR c++/85147)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The following testcase ICEs in fixed_parameter_pack_p_1, because parm is
error_mark_node and we assert it is one of the 3 TREE_CODEs we handle.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
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.
--- gcc/cp/pt.c.jj 2018-03-30 20:37:36.000000000 +0200
+++ gcc/cp/pt.c 2018-04-03 09:18:17.530206448 +0200
@@ -5101,7 +5101,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)
{
--- gcc/testsuite/g++.dg/cpp0x/pr85147.C.jj 2018-04-03 09:25:31.141148605 +0200
+++ gcc/testsuite/g++.dg/cpp0x/pr85147.C 2018-04-03 09:26:49.308138185 +0200
@@ -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" }
Jakub