aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/crash111.C6
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b6bf88f..13f3484 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51398
+ * pt.c (parameter_of_template_p): Skip error_mark_node parameters.
+
2012-01-23 Jason Merrill <jason@redhat.com>
PR c++/51925
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a4460f1..e440be7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 41929df..37a5614 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51398
+ * g++.dg/template/crash111.C: New.
+
2012-01-23 Arnaud Charlet <charlet@adacore.com>
* ada/acats/tests/cxh/cxh1001.a: Removed, test not suitable on all
diff --git a/gcc/testsuite/g++.dg/template/crash111.C b/gcc/testsuite/g++.dg/template/crash111.C
new file mode 100644
index 0000000..f711260
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash111.C
@@ -0,0 +1,6 @@
+// PR c++/51398
+
+template<void, int N> struct A // { dg-error "not a valid type" }
+{
+ static const int i = N;
+};