Commit 2c1fb3ee by Jason Merrill Committed by Jason Merrill

re PR c++/47873 (virtual Inheritance - Covariant Virtual Function - Segfault)

	PR c++/47873
	* class.c (update_vtable_entry_for_fn): Check BINFO_LOST_PRIMARY_P
	after checking for a non-thunk.

From-SVN: r170576
parent 998871e9
2011-02-28 Jason Merrill <jason@redhat.com>
PR c++/47873
* class.c (update_vtable_entry_for_fn): Check BINFO_LOST_PRIMARY_P
after checking for a non-thunk.
2011-02-26 Jason Merrill <jason@redhat.com> 2011-02-26 Jason Merrill <jason@redhat.com>
PR c++/47904 PR c++/47904
......
...@@ -2250,10 +2250,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, ...@@ -2250,10 +2250,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
{ {
tree main_binfo = TYPE_BINFO (BINFO_TYPE (b)); tree main_binfo = TYPE_BINFO (BINFO_TYPE (b));
tree bv = chain_index (ix, BINFO_VIRTUALS (main_binfo)); tree bv = chain_index (ix, BINFO_VIRTUALS (main_binfo));
if (BINFO_LOST_PRIMARY_P (b))
lost = true;
if (!DECL_THUNK_P (TREE_VALUE (bv))) if (!DECL_THUNK_P (TREE_VALUE (bv)))
break; break;
if (BINFO_LOST_PRIMARY_P (b))
lost = true;
} }
first_defn = b; first_defn = b;
} }
......
2011-02-28 Jason Merrill <jason@redhat.com>
* g++.dg/inherit/covariant18.C: New.
2011-02-28 Jakub Jelinek <jakub@redhat.com> 2011-02-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/47893 PR middle-end/47893
......
// PR c++/47873
// { dg-do run }
struct Base
{
virtual ~Base(){}
virtual Base& This() { return *this; }
};
struct Ent : virtual Base
{
void *m_Body;
Ent& This() { return *this; }
virtual Ent& body()
{
return This();
}
};
struct Msg : virtual Ent
{
Msg()
{
body();
}
Msg& This() { return *this; }
};
int main()
{
Msg m;
return 0;
}
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