aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}
}