re PR c++/10218 (ICE in make_decl_rtl for invalid code)
authorMark Mitchell <mark@codesourcery.com>
Fri, 28 Mar 2003 21:18:39 +0000 (21:18 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 28 Mar 2003 21:18:39 +0000 (21:18 +0000)
PR c++/10218
* decl.c (grokfndecl): Return NULL_TREE for bogus out-of-class
definitions.

From-SVN: r64985

gcc/cp/ChangeLog
gcc/cp/decl.c

index 7a86f1d01b2da8212b0a575451f4d2099ff89a1e..efced90578c5888759683a313e88a58cfbda15f0 100644 (file)
@@ -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
index 4756cdce9021c45585f30c471e28efc95194caae..969d0994e2adf5d61562a23f0a729cc0a1a8b6c7 100644 (file)
@@ -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;
        }
     }