* decl2.c (mark_vtable_entries): Don't make a copy of a function,
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 May 1999 23:38:55 +0000 (23:38 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 May 1999 23:38:55 +0000 (23:38 +0000)
and then make it look like `abort'.  Just use `abort' instead.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27131 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.old-deja/g++.pt/virtual2.C [new file with mode: 0644]

index 250f063..835402f 100644 (file)
@@ -1,5 +1,8 @@
 1999-05-24  Mark Mitchell  <mark@codesourcery.com>
 
+       * 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.
index 9427c2c..793a974 100644 (file)
@@ -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 (file)
index 0000000..052b049
--- /dev/null
@@ -0,0 +1,21 @@
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+template <class T>
+struct B 
+{
+  virtual void f() = 0;
+};
+
+template <class T>
+struct D : public B<T> {
+  virtual void f();
+};
+
+void g() {
+  B<int>* bi = new D<int>;
+};
+
+template <class T>
+void B<T>::f() {}
+