+2005-10-13 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/23984
+ * class.c (build_base_path): The vtable is always the first thing
+ in the vtt.
+
2005-10-13 Mark Mitchell <mark@codesourcery.com>
PR c++/20721
if (fixed_type_p < 0 && in_base_initializer)
{
- /* In a base member initializer, we cannot rely on
- the vtable being set up. We have to use the vtt_parm. */
- tree derived = BINFO_INHERITANCE_CHAIN (v_binfo);
+ /* In a base member initializer, we cannot rely on the
+ vtable being set up. We have to indirect via the
+ vtt_parm. */
tree t;
- t = TREE_TYPE (TYPE_VFIELD (BINFO_TYPE (derived)));
+ t = TREE_TYPE (TYPE_VFIELD (current_class_type));
t = build_pointer_type (t);
v_offset = convert (t, current_vtt_parm);
- v_offset = build2 (PLUS_EXPR, t, v_offset,
- BINFO_VPTR_INDEX (derived));
v_offset = build_indirect_ref (v_offset, NULL);
}
else
--- /dev/null
+// { dg-do run }
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 13 Oct 2005 <nathan@codesourcery.com>
+
+// PR 23984:ICE
+// Origin: Andrew Pinski pinskia@gcc.gnu.org
+
+struct B
+{
+ virtual void Foo ();
+};
+
+void B::Foo ()
+{
+}
+
+struct D : virtual B
+{
+};
+
+struct E
+{
+ B *ptr;
+
+ E (B *);
+};
+
+static B *ptr;
+
+E::E (B *ptr_)
+ :ptr (ptr_)
+{
+}
+
+struct G : D, E
+{
+ G ();
+};
+
+G::G ()
+ : E (this)
+{
+}
+
+int main ()
+{
+ G object;
+
+ return object.ptr != &object;
+}