aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/crash110.C7
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 610baa2..94e6dc9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51402
+ * pt.c (lookup_template_class_1): Check context returned by
+ tsubst for error_mark_node.
+
2012-01-19 Kai Tietz <ktietz@redhat.com>
PR c++/51344
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 87ec5f5..a4460f1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1,6 +1,6 @@
/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
@@ -7466,6 +7466,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
context = tsubst (DECL_CONTEXT (gen_tmpl), arglist,
complain, in_decl);
+ if (context == error_mark_node)
+ return error_mark_node;
+
if (!context)
context = global_namespace;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8da1e54..7db1f79 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51402
+ * g++.dg/template/crash110.C: New.
+
2012-01-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.misc-tests/gcov-14.c: Skip on alpha*-dec-osf*.
diff --git a/gcc/testsuite/g++.dg/template/crash110.C b/gcc/testsuite/g++.dg/template/crash110.C
new file mode 100644
index 0000000..d0a4b4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash110.C
@@ -0,0 +1,7 @@
+// PR c++/51402
+
+template<void> struct A // { dg-error "not a valid type" }
+{
+ template<int,int> struct B {};
+ template<int N> struct B<N,N> {};
+};