From: Paolo Carlini Date: Mon, 2 Jun 2008 21:27:35 +0000 (+0000) Subject: re PR c++/36404 (ICE with invalid enum) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80d7287f402d124caef566cbcbe023ebfab62f28;p=gcc.git re PR c++/36404 (ICE with invalid enum) /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. From-SVN: r136295 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6fe0199de48..54afddc9851 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 95440c98023..4bb43addb74 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 6cacd32cdb5..0bfe14a3538 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 05aeebb8055..e16f6b589e5 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 00000000000..be71848fe83 --- /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" }