/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Sep 2008 20:38:32 +0000 (20:38 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Sep 2008 20:38:32 +0000 (20:38 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140670 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash82.C [new file with mode: 0644]

index 88f8686..8c722d8 100644 (file)
@@ -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.
index 946b321..a04d731 100644 (file)
@@ -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
index 2941ac9..03d9d18 100644 (file)
@@ -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 (file)
index 0000000..4145691
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/37649
+
+struct A
+{
+  template<int> struct {}; // { dg-error "template class without a name" }
+};