2.011 invariant question

Sönke Ludwig ludwig at informatik_dot_uni-luebeck.de
Wed Feb 27 00:48:37 PST 2008


Sönke Ludwig wrote:

> 
> -----------------
> struct FOO {
>     invariant int x;
>     int y;
> }
> 
> int main()
> {
>     FOO bar;
>     bar.y = 2;
>     return 0;
> }
> -----------------
> gives the error:
> test4.d(9): variable test4.main.bar cannot modify struct with immutable 
> members
> 

added bugzilla #1873 for reference.



More information about the Digitalmars-d mailing list