typeid, typeinfo, classinfo not returning most derived
Amex
Amex at gmail.com
Thu Jun 6 20:22:00 UTC 2019
- x 0x004b71e0 {Interface for main.I} {m_init={length=0
ptr=0x00000000}, name="main.I", vtbl={length=0 ptr=0x00000000},
...} object.TypeInfo_Class {TypeInfo_Class}
[TypeInfo_Class] D0006: Error: Type resolve failed
m_init {length=0 ptr=0x00000000} byte[]
+ name "main.I" string
vtbl {length=0 ptr=0x00000000} void*[]
interfaces {length=0 ptr=0x00000000} object.Interface[]
base 0x00000000 object.TypeInfo_Class
destructor 0x00000000 void*
classInvariant 0x00000000 void function(object.Object)*
m_flags 36 uint
deallocator 0x00000000 void*
m_offTi {length=0 ptr=0x00000000} object.OffsetTypeInfo[]
defaultConstructor 0x00000000 void function(object.Object)*
m_RTInfo 0x00000000 const(void)*
- i 0x004b71e0 {Interface for main.I} {m_init={length=0
ptr=0x00000000}, name="main.I", vtbl={length=0 ptr=0x00000000},
...} object.TypeInfo_Class {TypeInfo_Class}
[TypeInfo_Class] D0006: Error: Type resolve failed
m_init {length=0 ptr=0x00000000} byte[]
+ name "main.I" string
vtbl {length=0 ptr=0x00000000} void*[]
interfaces {length=0 ptr=0x00000000} object.Interface[]
base 0x00000000 object.TypeInfo_Class
destructor 0x00000000 void*
classInvariant 0x00000000 void function(object.Object)*
m_flags 36 uint
deallocator 0x00000000 void*
m_offTi {length=0 ptr=0x00000000} object.OffsetTypeInfo[]
defaultConstructor 0x00000000 void function(object.Object)*
m_RTInfo 0x00000000 const(void)*
- c 0x004b71e0 {Interface for main.I} {m_init={length=0
ptr=0x00000000}, name="main.I", vtbl={length=0 ptr=0x00000000},
...} object.TypeInfo_Class {TypeInfo_Class}
[TypeInfo_Class] D0006: Error: Type resolve failed
m_init {length=0 ptr=0x00000000} byte[]
+ name "main.I" string
vtbl {length=0 ptr=0x00000000} void*[]
interfaces {length=0 ptr=0x00000000} object.Interface[]
base 0x00000000 object.TypeInfo_Class
destructor 0x00000000 void*
classInvariant 0x00000000 void function(object.Object)*
m_flags 36 uint
deallocator 0x00000000 void*
m_offTi {length=0 ptr=0x00000000} object.OffsetTypeInfo[]
defaultConstructor 0x00000000 void function(object.Object)*
m_RTInfo 0x00000000 const(void)*
Simply for the code
auto info(T)(T o)
{
auto x = typeid(o);
auto i = x.typeinfo;
auto c = o.classinfo;
return;
}
info exists in it's own module called from the main module.
interface I
{
void foo();
}
abstract class A : I
{
}
class C : A
{
void foo()
{
writeln("x");
}
}
class D : C { }
and
I i = new D();
info(i);
(more or less)
More information about the Digitalmars-d-learn
mailing list