This commit https://github.com/dlang/dmd/pull/10796, adds support for retireving the dynamic class name at compile time. but it only works with typeid and not classinfo, which should be supported too since therey are the same thing. --- string classname(Object o) { return typeid(o).name; } string classnameAlt(Object o) { return o.classinfo.name; } class Panzer {} class Tiger : Panzer {} static assert (() { Panzer p = new Tiger(); return classname(p); } () == "Tiger"); // OK static assert (() { Panzer p = new Tiger(); return classnameAlt(p); } () == "Tiger"); // NG ---
because of https://issues.dlang.org/show_bug.cgi?id=8059