DMD 2.059:

struct S{
    immutable x = [1];
    immutable y = 1;
}

void main(){
    writeln(S.x);        // ok
    writeln(&S.x);       // ok
    writeln(S.y);        // ok
    // writeln(&S.y);    // error
    with(S) writeln(&y); // ok (but resulting pointer is wrong)
}

This behaviour is obviously buggy, but I am not sure to what extent.

What is the intended behaviour? Should initialised immutable instance
variables be accessible without an instance at all?

Reply via email to