[Issue 13833] .classinfo.name (and typeid(obj)) does not print proper dynamic type when using an interface

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 4 08:12:05 PDT 2016


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

Lodovico Giaretta <lodovico at giaretart.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lodovico at giaretart.net

--- Comment #3 from Lodovico Giaretta <lodovico at giaretart.net> ---
Being pedantic, the spec does not state what happens when the static type of
the expression is an interface. In fact it says that "if the type is a class,
it returns the TypeInfo of the dynamic type (i.e. the most derived type)".

But the current behaviour is certainly a bug, and very confusing when
encountered. See for example
http://forum.dlang.org/thread/gdjaoxypicsxlfvzwbvt@forum.dlang.org

This is worth a bugfix in both the implementation and the documentation.

--


More information about the Digitalmars-d-bugs mailing list