aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-03-28 21:18:39 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-03-28 21:18:39 +0000
commit316a245627777e0fa9ada338df69d4242eb29014 (patch)
tree96505e9bdbc2274f7acf79b824f3c4c5045a2d3d
parent5c033b9febd9ec36a304f19e50cfd5e57a1280a6 (diff)
downloadgcc-316a245627777e0fa9ada338df69d4242eb29014.zip
gcc-316a245627777e0fa9ada338df69d4242eb29014.tar.gz
gcc-316a245627777e0fa9ada338df69d4242eb29014.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7a86f1d..efced90 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2003-03-28 Mark Mitchell <mark@codesourcery.com>
+ 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 4756cdc..969d099 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;
}
}