+2000-05-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo.h (__user_type_info::contained_virtual_p): New
+ predicate.
+ * tinfo.cc (__user_type_info::do_upcast): Fix bug with diamond
+ shaped heirarchy.
+ (__vmi_class_type_info::__do_upcast): Fix bug with NULL pointer to
+ diamond shaped heirarchy. Add early out for mixed diamond and
+ duplicate shaped heirarchy.
+
2000-05-24 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (build_delete): Change prototype.
sub_access = sub_kind (sub_access | contained_virtual_mask);
if (base_list[i].access != PUBLIC)
sub_access = sub_kind (sub_access & ~contained_public_mask);
- if (base_list[i].base->do_upcast (sub_access, target, p, result2))
+ if (base_list[i].base->do_upcast (sub_access, target, p, result2)
+ && !contained_virtual_p (result2.whole2target))
return true; // must fail
if (result2.base_type)
{
result.whole2target = contained_ambig;
return true;
}
+ result.whole2target
+ = sub_kind (result.whole2target | result2.whole2target);
}
}
}
}
else
{
+ if (!virtual_p (result.part2dst))
+ return true; // cannot have another path
if (!(vmi_flags & diamond_shaped_mask))
- return true; // cannot have a more accessible base
+ return true; // cannot have a more accessible path
}
}
else if (result.dst_ptr != result2.dst_ptr)
result.part2dst = __contained_ambig;
return true;
}
+ result.part2dst
+ = __sub_kind (result.part2dst | result2.part2dst);
}
}
}
return (access_path & (contained_mask | contained_virtual_mask))
== contained_mask;
}
+ static inline bool contained_virtual_p (sub_kind access_path)
+ {
+ return (access_path & (contained_mask | contained_virtual_mask))
+ == (contained_mask | contained_virtual_mask);
+ }
struct upcast_result
{