From a4aaa624ebc974c543cfc2ee9cfb1b97dc48f2a4 Mon Sep 17 00:00:00 2001 From: paolo Date: Mon, 2 Jun 2008 21:27:35 +0000 Subject: [PATCH] /cp 2008-06-02 Paolo Carlini PR c++/36404 * pt.c (push_template_decl_real): Consistently return error_mark_node on error. /testsuite 2008-06-02 Paolo Carlini PR c++/36404 * g++.dg/template/crash79.C: New. * g++.dg/other/pr28114.C: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136295 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 5 ++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/other/pr28114.C | 2 +- gcc/testsuite/g++.dg/template/crash79.C | 9 +++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/crash79.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6fe0199..54afddc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-02 Paolo Carlini + + PR c++/36404 + * pt.c (push_template_decl_real): Consistently return error_mark_node + on error. + 2008-06-02 Tomas Bily * typeck.c (is_bitfield_expr_with_lowered_type): Use CASE_CONVERT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 95440c9..4bb43ad 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3791,7 +3791,10 @@ push_template_decl_real (tree decl, bool is_friend) member_template_p = true; if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl))) - error ("template class without a name"); + { + error ("template class without a name"); + return error_mark_node; + } else if (TREE_CODE (decl) == FUNCTION_DECL) { if (DECL_DESTRUCTOR_P (decl)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6cacd32..0bfe14a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-06-02 Paolo Carlini + + PR c++/36404 + * g++.dg/template/crash79.C: New. + * g++.dg/other/pr28114.C: Adjust. + 2008-06-02 Daniel Kraft * finalize_1.f08: New test. diff --git a/gcc/testsuite/g++.dg/other/pr28114.C b/gcc/testsuite/g++.dg/other/pr28114.C index 05aeebb..e16f6b5 100644 --- a/gcc/testsuite/g++.dg/other/pr28114.C +++ b/gcc/testsuite/g++.dg/other/pr28114.C @@ -5,5 +5,5 @@ template void foo(struct {}*); // { dg-error "" } void bar() { - foo<0>(0); // { dg-error "" } + foo<0>(0); } diff --git a/gcc/testsuite/g++.dg/template/crash79.C b/gcc/testsuite/g++.dg/template/crash79.C new file mode 100644 index 0000000..be71848 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash79.C @@ -0,0 +1,9 @@ +// PR c++/36404 + +struct A +{ + A(int); + template enum { e }; // { dg-error "template" } +}; + +A a(A::e); // { dg-error "not a member" } -- 2.7.4