From 0ea8c695c52cdbd57f66a5fa3cc80ba335fc64a5 Mon Sep 17 00:00:00 2001 From: paolo Date: Thu, 25 Sep 2008 20:38:32 +0000 Subject: [PATCH] /cp 2008-09-25 Paolo Carlini 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 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 | 6 ++++++ gcc/cp/name-lookup.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/crash82.C | 6 ++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/crash82.C 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 + + 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 * 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 + + PR c++/37649 + * g++.dg/template/crash82.C: New. + 2008-09-25 Tobias Burnus 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 struct {}; // { dg-error "template class without a name" } +}; -- 2.7.4