* decl.c (start_function): Robustify.
authorMark Mitchell <mark@codesourcery.com>
Tue, 19 Sep 2000 07:29:33 +0000 (07:29 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 19 Sep 2000 07:29:33 +0000 (07:29 +0000)
From-SVN: r36527

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.other/crash23.C [new file with mode: 0644]

index 62fa62dd2130ec2f0025a93075c0d954306a49d2..c29b29565e49c4e3dc826cc60aff12f485f31320 100644 (file)
@@ -1,3 +1,7 @@
+2000-09-18  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (start_function): Robustify.
+
 2000-09-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * cp-tree.h (check_function_format): Accept a `status' parameter.
index 3b2a0573b53609218ac99d5b5d55da617c9662bb..e016e3321041d9230af5b4b31ca4c3da9942d748 100644 (file)
@@ -13711,9 +13711,14 @@ start_function (declspecs, declarator, attrs, flags)
   current_function_decl = decl1;
   cfun->decl = decl1;
 
-  my_friendly_assert ((DECL_PENDING_INLINE_P (decl1) 
-                      || !DECL_SAVED_FUNCTION_DATA (decl1)),
-                     20000911);
+  /* If we are (erroneously) defining a function that we have already
+     defined before, wipe out what we knew before.  */
+  if (!DECL_PENDING_INLINE_P (decl1) 
+      && DECL_SAVED_FUNCTION_DATA (decl1))
+    {
+      free (DECL_SAVED_FUNCTION_DATA (decl1));
+      DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
+    }
 
   if (ctype && !doing_friend && !DECL_STATIC_FUNCTION_P (decl1))
     {
diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash23.C b/gcc/testsuite/g++.old-deja/g++.other/crash23.C
new file mode 100644 (file)
index 0000000..afe0920
--- /dev/null
@@ -0,0 +1,7 @@
+// Build don't link:
+// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+class T;
+inline void operator<(T&, T&) { }
+inline void operator<(T&, T&) { }
+