https://issues.dlang.org/show_bug.cgi?id=14612

Rainer Schuetze <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Rainer Schuetze <[email protected]> ---
The language spec says for both typeid() and .classinfo that the dynamic type
is returned. For classinfo, it says ".classinfo applied to an interface gives
the information for the interface, not the class it might be an instance of."
which makes it a compile time property for interfaces. I could not find a spec
for typeid regarding interfaces.

I suspect they are supposed to be the same. That means typeid(i) and
i.classinfo should evaluate to typeid(I). This must be generated by the
compiler.

Actually I think the semantics are pretty arbitrary and not intuitive. Why
would anyone expect J to be the correct type? I'd rather prefer if both classes
and interfaces would return the dynamic type, i.e. typeid(D). You can get the
static type of an expression by using typeid(typeof(i)).

--

Reply via email to