mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/23984 (second operand of PLUS_EXPR is NULL (in constructor))
cp: PR c++/23984 * class.c (build_base_path): The vtable is always the first thing in the vtt. testsuite: PR c++/23984 * g++.dg/init/ctor7.C: New. From-SVN: r105396
This commit is contained in:
parent
9da32d6309
commit
2acb1af9aa
|
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -325,16 +325,14 @@ build_base_path (enum tree_code code,
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2005-10-14 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/23984
|
||||
* g++.dg/init/ctor7.C: New.
|
||||
|
||||
2005-10-13 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
PR c++/23730
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
// { 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;
|
||||
}
|
||||
Loading…
Reference in New Issue