Commit 2acb1af9 by Nathan Sidwell Committed by Nathan Sidwell

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
parent 9da32d63
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> 2005-10-13 Mark Mitchell <mark@codesourcery.com>
PR c++/20721 PR c++/20721
......
...@@ -325,16 +325,14 @@ build_base_path (enum tree_code code, ...@@ -325,16 +325,14 @@ build_base_path (enum tree_code code,
if (fixed_type_p < 0 && in_base_initializer) if (fixed_type_p < 0 && in_base_initializer)
{ {
/* In a base member initializer, we cannot rely on /* In a base member initializer, we cannot rely on the
the vtable being set up. We have to use the vtt_parm. */ vtable being set up. We have to indirect via the
tree derived = BINFO_INHERITANCE_CHAIN (v_binfo); vtt_parm. */
tree t; tree t;
t = TREE_TYPE (TYPE_VFIELD (BINFO_TYPE (derived))); t = TREE_TYPE (TYPE_VFIELD (current_class_type));
t = build_pointer_type (t); t = build_pointer_type (t);
v_offset = convert (t, current_vtt_parm); 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); v_offset = build_indirect_ref (v_offset, NULL);
} }
else else
......
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> 2005-10-13 David Edelsohn <edelsohn@gnu.org>
PR c++/23730 PR c++/23730
// { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment