This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 37649
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 25 Sep 2008 12:15:32 +0200
- Subject: [C++ Patch] PR 37649
Hi,
tested x86_64-linux. Ok for mainline?
Thanks,
Paolo.
////////////////////
/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.
Index: testsuite/g++.dg/template/crash82.C
===================================================================
*** testsuite/g++.dg/template/crash82.C (revision 0)
--- testsuite/g++.dg/template/crash82.C (revision 0)
***************
*** 0 ****
--- 1,6 ----
+ // PR c++/37649
+
+ struct A
+ {
+ template<int> struct {}; // { dg-error "template class without a name" }
+ };
Index: cp/name-lookup.c
===================================================================
*** cp/name-lookup.c (revision 140633)
--- cp/name-lookup.c (working copy)
*************** maybe_process_template_type_declaration
*** 4936,4941 ****
--- 4936,4944 ----
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