From 78c120b5675cd6619184d8909c4469fd44ec0135 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 19 Sep 2000 07:29:33 +0000 Subject: [PATCH] * decl.c (start_function): Robustify. From-SVN: r36527 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 11 ++++++++--- gcc/testsuite/g++.old-deja/g++.other/crash23.C | 7 +++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/crash23.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62fa62dd213..c29b29565e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-09-18 Mark Mitchell + + * decl.c (start_function): Robustify. + 2000-09-18 Kaveh R. Ghazi * cp-tree.h (check_function_format): Accept a `status' parameter. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3b2a0573b53..e016e332104 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 index 00000000000..afe09204024 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/crash23.C @@ -0,0 +1,7 @@ +// Build don't link: +// Origin: Gerald Pfeifer + +class T; +inline void operator<(T&, T&) { } +inline void operator<(T&, T&) { } +