how to get typeid of extern(C++) classes?
Timothee Cour
thelastmammoth at gmail.com
Fri Feb 16 00:42:02 UTC 2018
is there a way to get typeid of extern(C++) classes (eg for ones in
dmd/astbase.d but not limited to that) ?
C++ exposes it via typeid so in theory all the info is there ;
I would need it at least for debugging (eg if RTTI is not enabled for
all compilers or in release mode that's fine so long there's a
documented way to get it for debugging)
a lot of extern(C++) classes in dmd use hacks like enum values to get
their type but it's unreliable and doesn't work for all AST classes.
at least having a way to expose typeid(instance).name() would be a start
also, that could be used to fix the bug I posted here:
https://forum.dlang.org/post/mailman.3138.1517949584.9493.digitalmars-d@puremagic.com
cast overly permissive with extern(C++ ) classes; ( ie that `cast(A)
b` doesn't care that b is of dynamic type A)
More information about the Digitalmars-d
mailing list