-- struct S { int i; immutable(Object) o;
S opUnary(string op)() { return this; } void opAssign(S other) {} } void main() { S s, t; t = s; // OK ++s; // OK s++; // Error: cannot modify struct s S with immutable members } ---
Nicolas Sicard via Digitalmars-d-learn Tue, 24 Mar 2015 09:50:27 -0700
-- struct S { int i; immutable(Object) o;
S opUnary(string op)() { return this; } void opAssign(S other) {} } void main() { S s, t; t = s; // OK ++s; // OK s++; // Error: cannot modify struct s S with immutable members } ---