+2001-06-14 Jason Merrill <jason_merrill@redhat.com>
+
+ * class.c (dfs_find_final_overrider): Fix logic.
+
+ * class.c (update_vtable_entry_for_fn): Uncomment optimization to use
+ virtual thunk instead of non-virtual.
+ (get_matching_virtual): Uncomment.
+
+ * pt.c (unify): Don't recurse between the POINTER_TYPE and the
+ OFFSET_TYPE. If we're adding cv-quals, the extra ones would be on
+ PARM, not ARG.
+
2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
* class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure
ffod->overriding_fn = method;
ffod->overriding_base = TREE_VALUE (path);
}
- /* If we found the same overrider we already have, then
- we just need to check that we're finding it in the same
- place. */
- else if (ffod->overriding_fn == method)
+ else if (ffod->overriding_fn)
{
- if (ffod->overriding_base
- && (!tree_int_cst_equal
+ /* We had a best overrider; let's see how this compares. */
+
+ if (ffod->overriding_fn == method
+ && (tree_int_cst_equal
(BINFO_OFFSET (TREE_VALUE (path)),
BINFO_OFFSET (ffod->overriding_base))))
+ /* We found the same overrider we already have, and in the
+ same place; it's still the best. */;
+ else if (strictly_overrides (ffod->overriding_fn, method))
+ /* The old function overrides this function; it's still the
+ best. */;
+ else if (strictly_overrides (method, ffod->overriding_fn))
+ {
+ /* The new function overrides the old; it's now the
+ best. */
+ ffod->overriding_fn = method;
+ ffod->overriding_base = TREE_VALUE (path);
+ }
+ else
{
+ /* Ambiguous. */
ffod->candidates
= build_tree_list (NULL_TREE,
ffod->overriding_fn);
+ if (method != ffod->overriding_fn)
+ ffod->candidates
+ = tree_cons (NULL_TREE, method, ffod->candidates);
ffod->overriding_fn = NULL_TREE;
ffod->overriding_base = NULL_TREE;
}
}
- /* If there was already an overrider, and it overrides this
- function, then the old overrider is still the best
- candidate. */
- else if (ffod->overriding_fn
- && strictly_overrides (ffod->overriding_fn,
- method))
- ;
else
{
+ /* We had a list of ambiguous overrides; let's see how this
+ new one compares. */
+
tree candidates;
bool incomparable = false;
return build_tree_list (ffod.overriding_fn, ffod.overriding_base);
}
-#if 0
/* Returns the function from the BINFO_VIRTUALS entry in T which matches
the signature of FUNCTION_DECL FN, or NULL_TREE if none. In other words,
the function that the slot in T's primary vtable points to. */
return BV_FN (f);
return NULL_TREE;
}
-#endif
/* Update an entry in the vtable for BINFO, which is in the hierarchy
dominated by T. FN has been overriden in BINFO; VIRTUALS points to the
delta = size_diffop (BINFO_OFFSET (TREE_VALUE (overrider)),
BINFO_OFFSET (binfo));
-#if 0
- /* Disable this optimization pending an ABI change, or until
- we can force emission of the non-virtual thunk even if we don't
- use it. */
if (! integer_zerop (delta))
{
/* We'll need a thunk. But if we have a (perhaps formerly)
}
}
}
-#endif
}
modify_vtable_entry (t,
return 1;
if (!(strict & UNIFY_ALLOW_OUTER_LEVEL)
- && TYPE_P (arg) && !CP_TYPE_CONST_P (arg))
+ && TYPE_P (parm) && !CP_TYPE_CONST_P (parm))
strict &= ~UNIFY_ALLOW_MORE_CV_QUAL;
strict &= ~UNIFY_ALLOW_OUTER_LEVEL;
strict &= ~UNIFY_ALLOW_DERIVED;
level of pointers. */
strict |= (strict_in & UNIFY_ALLOW_DERIVED);
+ if (TREE_CODE (TREE_TYPE (parm)) == OFFSET_TYPE
+ && TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
+ {
+ /* Avoid getting confused about cv-quals; don't recurse here.
+ Pointers to members should really be just OFFSET_TYPE, not
+ this two-level nonsense... */
+
+ parm = TREE_TYPE (parm);
+ arg = TREE_TYPE (arg);
+ goto offset;
+ }
+
return unify (tparms, targs, TREE_TYPE (parm),
TREE_TYPE (arg), strict);
}
DEDUCE_EXACT, 0, -1);
case OFFSET_TYPE:
+ offset:
if (TREE_CODE (arg) != OFFSET_TYPE)
return 1;
if (unify (tparms, targs, TYPE_OFFSET_BASETYPE (parm),