I am trying to learn more about the usage of immutable. This is a little D2 program:
immutable class S {
static int x;
static this() {
S.x = 10;
}
}
void main() {}
The compiler outputs:
test.d(3): Error: function test2.S._staticCtor1 without 'this' cannot be const/immutable
Can you tell me what's wrong or how I can fix it?
Bye and thank you,
bearophile