https://issues.dlang.org/show_bug.cgi?id=14612
--- Comment #5 from Kenji Hara <[email protected]> --- (In reply to Rainer Schuetze from comment #4) > cast(Object) creates a call into the runtime (_d_interface_cast) and is > pretty expensive. It could be optimized to the series of indirections by the > compiler, though. Actually _d_interface_cast is not so high cost so Object has no base class and implements no interfaces. > I guess the current behaviour could be described as "typeid(I) evaluates to > the most derived interface that is implemented by the object and that > inherits from the static type." > > But "most derived" is not well defined when it comes to inheriting from > multiple interfaces: It would be visible when you consider the class object layout. > interface I {} > interface J : I {} > interface K : I {} > class E : J, K {} // I I // E : J, K //=============== // ij ik // | | // j k // | | // e --[x]-[y] [x] is the "most derived vptr slot of ij, and [y] is of ik. --
