tiemann@arkesden.eng.sun.com (Michael Tiemann) (11/27/89)
You win the prize! There was one multiple-inheritance bug that was
stopping some friends of mine at Boulder (Dirk, do you still watch
this space?), but they couldn't narrow it down. I think that you
might have found the same one idenpendently. So identified, it was
very easy to fix:
arkesden% diff -c2 cplus-typeck.c~ cplus-typeck.c
*** cplus-typeck.c~ Tue Nov 14 13:49:35 1989
--- cplus-typeck.c Sun Nov 26 22:56:34 1989
***************
*** 1264,1275 ****
if (TREE_CODE (TYPE_NAME (context)) == TYPE_DECL)
{
! if (DECL_OFFSET (TYPE_NAME (context)) != 0)
! intermediate = build (COMPONENT_REF, TREE_TYPE (datum), datum,
! TYPE_NAME (context));
! else if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
! && value_member (context,
! CLASSTYPE_VBASECLASSES (basetype)))
{
! tree ptr = build_vbase_pointer (datum, context);
intermediate = build_indirect_ref (ptr, 0);
}
--- 1264,1285 ----
if (TREE_CODE (TYPE_NAME (context)) == TYPE_DECL)
{
! tree assoc = value_member (context, CLASSTYPE_ASSOC (basetype));
! if (assoc)
{
! context = TREE_TYPE (assoc);
! if (DECL_OFFSET (TYPE_NAME (context)) != 0)
! intermediate = build (COMPONENT_REF, TREE_TYPE (datum), datum,
! TYPE_NAME (context));
! }
! else
! {
! tree ptr;
!
! if (TYPE_USES_VIRTUAL_BASECLASSES (basetype))
! assoc = value_member (DECL_FIELD_CONTEXT (field),
! CLASSTYPE_VBASECLASSES (basetype));
! assert (assoc != NULL_TREE);
! context = TREE_TYPE (assoc);
! ptr = build_vbase_pointer (datum, context);
intermediate = build_indirect_ref (ptr, 0);
}
arkesden%
And the results:
arkesden% !g
g++ -B./ l8.cc
arkesden% a.out
a = 0, b = 0.
a = 1, b = 0.
arkesden%
Michael