From: Mark Mitchell Date: Mon, 24 May 1999 23:38:55 +0000 (+0000) Subject: decl2.c (mark_vtable_entries): Don't make a copy of a function, and then make it... X-Git-Tag: releases/libgcj-2.95.0~384 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e65d3ee9ada6d20eff5a09d6c2a8af695887913;p=thirdparty%2Fgcc.git decl2.c (mark_vtable_entries): Don't make a copy of a function, and then make it look like `abort'. * decl2.c (mark_vtable_entries): Don't make a copy of a function, and then make it look like `abort'. Just use `abort' instead. From-SVN: r27131 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 250f063b7685..835402f0f0cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 1999-05-24 Mark Mitchell + * decl2.c (mark_vtable_entries): Don't make a copy of a function, + and then make it look like `abort'. Just use `abort' instead. + * typeck.c (build_static_cast): Don't allow static_casts that cast away constness. (casts_away_constness_r): New function. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9427c2c6ba4d..793a974c1e35 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2424,8 +2424,7 @@ mark_vtable_entries (decl) TREE_ADDRESSABLE (fn) = 1; if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn)) { - TREE_OPERAND (fnaddr, 0) = fn = copy_node (fn); - DECL_RTL (fn) = DECL_RTL (abort_fndecl); + TREE_OPERAND (fnaddr, 0) = abort_fndecl; mark_used (abort_fndecl); } if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn)) diff --git a/gcc/testsuite/g++.old-deja/g++.pt/virtual2.C b/gcc/testsuite/g++.old-deja/g++.pt/virtual2.C new file mode 100644 index 000000000000..052b04979086 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/virtual2.C @@ -0,0 +1,21 @@ +// Build don't link: +// Origin: Mark Mitchell + +template +struct B +{ + virtual void f() = 0; +}; + +template +struct D : public B { + virtual void f(); +}; + +void g() { + B* bi = new D; +}; + +template +void B::f() {} +