--- Comment #1 from 2010-10-24 18:27:12 PDT ---
Currently this seems the most efficient way to have a static class attribute
that contains a __vptr (here converted to a size_t and named classId):

class Foo {
    static immutable size_t classId;
    static this() {
        classId = *(cast(size_t*)(typeid(Foo).init.ptr));
void main() {
    assert(cast(size_t)((new Foo).__vptr) == Foo.classId);

With it DMD 2.049 generates a very light static constructor:

_D4test3Foo12_staticCtor1FZv    comdat
        mov    EAX,_D4test3Foo7__ClassZ[0Ch]
        mov    ECX,[EAX]
        mov    _D4test3Foo7classIdyk,ECX

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to