summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-08 14:00:26 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-08 14:00:26 +0000
commit84e4d4a4f64642e49df707692d3cc9d5ca6b1f57 (patch)
treeb4a615519d887258689016d13781a8a21c025df0 /gcc/cp/class.c
parent0a2e2efe7b1ee1736e505930b197fef3929d49a7 (diff)
downloadgcc-84e4d4a4f64642e49df707692d3cc9d5ca6b1f57.tar.gz
PR c++/43120
* class.c (update_vtable_entry_for_fn): Fix handling of dummy virtual bases for covariant thunks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161954 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 3c4830e857e..20b8c1245c1 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2058,8 +2058,9 @@ get_vcall_index (tree fn, tree type)
}
/* Update an entry in the vtable for BINFO, which is in the hierarchy
- dominated by T. FN has been overridden in BINFO; VIRTUALS points to the
- corresponding position in the BINFO_VIRTUALS list. */
+ dominated by T. FN is the old function; VIRTUALS points to the
+ corresponding position in the new BINFO_VIRTUALS list. IX is the index
+ of that entry in the list. */
static void
update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
@@ -2252,9 +2253,11 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
virtual_base = probe;
if (virtual_base)
- /* Even if we find a virtual base, the correct delta is
- between the overrider and the binfo we're building a vtable
- for. */
+ /* OK, first_defn got this function from a (possibly lost) primary
+ virtual base, so we're going to use the vcall offset for that
+ primary virtual base. But the caller is passing a first_defn*,
+ not a virtual_base*, so the correct delta is the delta between
+ first_defn* and itself, i.e. zero. */
goto virtual_covariant;
}
@@ -2272,12 +2275,12 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
entry in our vtable. Except possibly in a constructor vtable,
if we happen to get our primary back. In that case, the offset
will be zero, as it will be a primary base. */
+ virtual_covariant:
delta = size_zero_node;
else
/* The `this' pointer needs to be adjusted from pointing to
BINFO to pointing at the base where the final overrider
appears. */
- virtual_covariant:
delta = size_diffop_loc (input_location,
convert (ssizetype,
BINFO_OFFSET (TREE_VALUE (overrider))),