Weird rule for immutable

Victor Porton porton at narod.ru
Sat Apr 11 01:24:53 UTC 2020


On Saturday, 11 April 2020 at 01:19:29 UTC, Victor Porton wrote:
> void f(ref immutable int v) { }
>
> int x = 1;
> f();
> x = 2; // the immutable reference does not exist at this point
>        // but the assignment is disallowed(?)

should be:

void f(ref immutable int v) { }

int x = 1;
f(x);
x = 2; // the immutable reference does not exist at this point
        // but the assignment is disallowed(?)


More information about the Digitalmars-d mailing list