aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2008-09-25 20:38:32 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-09-25 20:38:32 +0000
commit79faac542c819aaf3b985486059dd16155580a02 (patch)
treeb8e2cf7407e46a574e1f4451dd2753405418547a
parent6ffef2ad23a30121a2d29b9893a57743c7c86d2a (diff)
downloadgcc-79faac542c819aaf3b985486059dd16155580a02.zip
gcc-79faac542c819aaf3b985486059dd16155580a02.tar.gz
gcc-79faac542c819aaf3b985486059dd16155580a02.tar.bz2
re PR c++/37649 (ICE with invalid template class)
/cp 2008-09-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/37649 * name-lookup.c (maybe_process_template_type_declaration): Check return value of push_template_decl_real for error_mark_node. /testsuite 2008-09-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/37649 * g++.dg/template/crash82.C: New. From-SVN: r140670
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/crash82.C6
4 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 88f8686..8c722d8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37649
+ * name-lookup.c (maybe_process_template_type_declaration): Check
+ return value of push_template_decl_real for error_mark_node.
+
2008-09-24 Aldy Hernandez <aldyh@redhat.com>
* semantics.c (finish_fname): Pass location to fname_decl.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 946b321..a04d731 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4936,6 +4936,9 @@ maybe_process_template_type_declaration (tree type, int is_friend,
tree name = DECL_NAME (decl);
decl = push_template_decl_real (decl, is_friend);
+ if (decl == error_mark_node)
+ return error_mark_node;
+
/* If the current binding level is the binding level for the
template parameters (see the comment in
begin_template_parm_list) and the enclosing level is a class
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2941ac9..03d9d18 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-25 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/37649
+ * g++.dg/template/crash82.C: New.
+
2008-09-25 Tobias Burnus <burnus@net-b.de>
PR fortran/37504
diff --git a/gcc/testsuite/g++.dg/template/crash82.C b/gcc/testsuite/g++.dg/template/crash82.C
new file mode 100644
index 0000000..4145691
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash82.C
@@ -0,0 +1,6 @@
+// PR c++/37649
+
+struct A
+{
+ template<int> struct {}; // { dg-error "template class without a name" }
+};