diff --git a/src/rt/cast_.d b/src/rt/cast_.d index 5cc1d9841ff..158c0453298 100644 --- a/src/rt/cast_.d +++ b/src/rt/cast_.d @@ -84,39 +84,8 @@ int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset) if (oc.base is c) return true; - version(all) - { - // Bugzilla 2013: Until the ClassInfo.interfaces[] sturcture is fixed - // (it's generated by compiler), we should keep breadth-first search - // to avoid existing code breaking. - - // Before the compiler fix: - // When oc is a ClassInfo of interface type, iface.offset is always zero. - // So the offset addition has no operation. - // After the compiler fix: - // When oc is a ClassInfo of interface type, iface.offset may be nonzero. - foreach (iface; oc.interfaces) - { - if (iface.classinfo is c) - { - offset += iface.offset; - return true; - } - } - - foreach (iface; oc.interfaces) - { - if (_d_isbaseof2(iface.classinfo, c, offset)) - { - offset += iface.offset; - return true; - } - } - } - else - { - // Bugzilla 2013: After the compiler is actually fixed, we can simply use - // depth-first search to calculate class to base interface offset. + // Bugzilla 2013: Use depth-first search to calculate offset + // from the derived (oc) to the base (c). foreach (iface; oc.interfaces) { if (iface.classinfo is c || _d_isbaseof2(iface.classinfo, c, offset)) @@ -125,7 +94,6 @@ int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset) return true; } } - } oc = oc.base; } while(oc);