From 316a245627777e0fa9ada338df69d4242eb29014 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 28 Mar 2003 21:18:39 +0000 Subject: [PATCH] re PR c++/10218 (ICE in make_decl_rtl for invalid code) PR c++/10218 * decl.c (grokfndecl): Return NULL_TREE for bogus out-of-class definitions. From-SVN: r64985 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a86f1d01b2..efced90578c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-03-28 Mark Mitchell + PR c++/10218 + * decl.c (grokfndecl): Return NULL_TREE for bogus out-of-class + definitions. + * decl2.c (generate_ctor_or_dtor_function): Tolerate a non-existant ssdf_decls array. (finish_file): Call generator_ctor_or_dtor_function when there are diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4756cdce902..969d0994e2a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9132,6 +9132,8 @@ grokfndecl (tree ctype, if (old_decl) { + bool ok; + /* Since we've smashed OLD_DECL to its DECL_TEMPLATE_RESULT, we must do the same to DECL. */ if (TREE_CODE (decl) == TEMPLATE_DECL) @@ -9140,10 +9142,14 @@ grokfndecl (tree ctype, /* Attempt to merge the declarations. This can fail, in the case of some invalid specialization declarations. */ push_scope (ctype); - if (!duplicate_decls (decl, old_decl)) - error ("no `%#D' member function declared in class `%T'", - decl, ctype); + ok = duplicate_decls (decl, old_decl); pop_scope (ctype); + if (!ok) + { + error ("no `%#D' member function declared in class `%T'", + decl, ctype); + return NULL_TREE; + } return old_decl; } } -- 2.30.2