Static attributes aren' immutable

bearophile bearophileHUGS at lycos.com
Fri Mar 5 06:20:52 PST 2010


I'm playing some more with immutables in D2. This program compiles:

struct Foo {
    static int x;
}
void main() {
    immutable Foo f;
    Foo.x++;
    f.x++;
}

Is this code supposed to be correct? If I have an immutable struct I want all of it to be immutable...

Bye and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list