+2000-02-10 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (dfs_modify_vtables): Tweak calculation of functions to
+ override.
+
2000-02-08 Nathan Sidwell <nathan@acm.org>
* typeck.c (strip_all_pointer_quals): Use TYPE_MAIN_VARIANT, to
t = (tree) data;
- /* If we're support RTTI then we always need a new vtable to point
- to the RTTI information. Under the new ABI we may need a new
- vtable to contain vcall and vbase offsets. */
+ /* If we're supporting RTTI then we always need a new vtable to
+ point to the RTTI information. Under the new ABI we may need
+ a new vtable to contain vcall and vbase offsets. */
if (flag_rtti || flag_new_abi)
make_new_vtable (t, binfo);
tree overrider;
tree vindex;
tree delta;
+ int i;
/* Find the function which originally caused this vtable
entry to be present. */
b = dfs_walk (binfo, dfs_find_base, NULL, DECL_VIRTUAL_CONTEXT (fn));
fn = skip_rtti_stuff (TYPE_BINFO (BINFO_TYPE (b)),
BINFO_TYPE (b),
- NULL);
- while (!tree_int_cst_equal (DECL_VINDEX (BV_FN (fn)), vindex))
- fn = TREE_CHAIN (fn);
+ &i);
+ while (i < TREE_INT_CST_LOW (vindex))
+ {
+ fn = TREE_CHAIN (fn);
+ ++i;
+ }
fn = BV_FN (fn);
/* Handle the case of a virtual function defined in BINFO
--- /dev/null
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 8 Feb 2000 <nathan@acm.org>
+
+// vtable construction reorganisation broke this
+
+// execution test
+
+#include <stdio.h>
+
+static int fail = 0;
+
+void bad (char const *name)
+{
+ printf ("Bad %s\n", name);
+ fail = 1;
+}
+void ok (char const *name)
+{
+ printf ("Ok %s\n", name);
+}
+
+struct Core
+{
+ virtual ~Core ();
+ virtual void Wibble () {bad (__PRETTY_FUNCTION__);}
+ virtual void Wobble () {bad (__PRETTY_FUNCTION__);}
+ virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
+};
+struct Side
+{
+ virtual ~Side ();
+ virtual void Arfle () {bad (__PRETTY_FUNCTION__);}
+ virtual void Barfle () {bad (__PRETTY_FUNCTION__);}
+ virtual void Gloop () {bad (__PRETTY_FUNCTION__);}
+ virtual void Glorp () {bad (__PRETTY_FUNCTION__);}
+ virtual void Glump () {bad (__PRETTY_FUNCTION__);}
+ virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
+};
+struct Base : Core
+{
+ virtual ~Base ();
+ virtual void Bink () {bad (__PRETTY_FUNCTION__);}
+ virtual void Bonk () {bad (__PRETTY_FUNCTION__);}
+ virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
+};
+struct Multi : Base, Side
+{
+ virtual ~Multi ();
+ virtual void Stomped () {ok (__PRETTY_FUNCTION__);}
+ virtual void Bunk () {bad (__PRETTY_FUNCTION__);}
+ virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
+};
+struct Trail : Multi
+{
+ virtual ~Trail ();
+};
+Core::~Core () {}
+Side::~Side () {}
+Base::~Base () {}
+Multi::~Multi () {}
+Trail::~Trail () {}
+
+void foo (Multi *ptr)
+{
+ ptr->Stomped ();
+}
+
+int main ()
+{
+ Multi m;
+ Trail t;
+
+ foo (&m);
+ foo (&t);
+ return fail != 0;
+}