aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/error.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index acbdbe4..e5cc6f1 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -778,7 +778,8 @@ build_vfn_ref (tree instance_ptr, tree idx)
cp_build_addr_expr (aref, tf_warning_or_error));
/* Remember this as a method reference, for later devirtualization. */
- aref = build3 (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr, idx);
+ aref = build3 (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr,
+ fold_convert (TREE_TYPE (instance_ptr), idx));
return aref;
}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 1172dbe..8a3b7b5 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2149,7 +2149,7 @@ dump_expr_init_vec (cxx_pretty_printer *pp, vec<constructor_elt, va_gc> *v,
static tree
resolve_virtual_fun_from_obj_type_ref (tree ref)
{
- tree obj_type = TREE_TYPE (OBJ_TYPE_REF_OBJECT (ref));
+ tree obj_type = TREE_TYPE (OBJ_TYPE_REF_TOKEN (ref));
HOST_WIDE_INT index = tree_to_uhwi (OBJ_TYPE_REF_TOKEN (ref));
tree fun = BINFO_VIRTUALS (TYPE_BINFO (TREE_TYPE (obj_type)));
while (index)