Hi,
a small diagnostic regression. Normally, when we do 'TREE_VALUE
(TREE_VEC_ELT (*parms' we check for error_mark_node, because that's what
we store for erroneous parameters: doing that here too avoids the ICE.
Tested x86_64-linux.
Thanks,
Paolo.
/////////////////////////////
/cp
2012-01-23 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51398
* pt.c (parameter_of_template_p): Skip error_mark_node parameters.
/testsuite
2012-01-23 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51398
* g++.dg/template/crash111.C: New.
Index: testsuite/g++.dg/template/crash111.C
===================================================================
--- testsuite/g++.dg/template/crash111.C (revision 0)
+++ testsuite/g++.dg/template/crash111.C (revision 0)
@@ -0,0 +1,6 @@
+// PR c++/51398
+
+template<void, int N> struct A // { dg-error "not a valid type" }
+{
+ static const int i = N;
+};
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 183438)
+++ cp/pt.c (working copy)
@@ -8157,6 +8157,9 @@ parameter_of_template_p (tree parm, tree templ)
for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
{
tree p = TREE_VALUE (TREE_VEC_ELT (parms, i));
+ if (p == error_mark_node)
+ continue;
+
if (parm == p
|| (DECL_INITIAL (parm)
&& DECL_INITIAL (parm) == DECL_INITIAL (p)))