http://d.puremagic.com/issues/show_bug.cgi?id=3421



--- Comment #2 from Graham <grahamc00...@yahoo.co.uk> 2009-10-20 15:29:29 PDT 
---
Thanks.

Is there any way to put __gshared or immutable into a typedef or alias so that
conditional compilation can allow code to compile with both DMD v1 and DMD v2 ?

I thought something like this would do it:

import std.stdio;

static __gshared uint value1 = 3;
static immutable uint value2 = 4;

version(D_Version2) {
    mixin("typedef static __gshared uint __gshared_uint;");
    mixin("typedef static immutable uint immutable_uint;");
}
else {
    typedef static uint __gshared_uint;
    typedef static uint immutable_uint;
}

__gshared_uint value3 = 5;
immutable_uint value4 = 6;

void main() {
    uint save1, save2, save3, save4;
    asm {
        mov        EAX,value1;
        mov        save1,EAX;
        mov        EAX,value2;
        mov        save2,EAX;
        mov        EAX,value3;
        mov        save3,EAX;
        mov        EAX,value4;
        mov        save4,EAX;
    }
    writefln("save1 %d save2 %d save3 %d save4 %d", save1, save2, save3,
save4);
}

but it does not:
dmd -vtls test03
test03.d(15): value3 is thread local
test03.d(16): value4 is thread local

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to