Weird rule for immutable

Victor Porton porton at narod.ru
Sat Apr 11 01:43:39 UTC 2020


On Saturday, 11 April 2020 at 01:24:53 UTC, Victor Porton wrote:
> 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(?)

A related issue I've posted: 
https://issues.dlang.org/show_bug.cgi?id=20728


More information about the Digitalmars-d mailing list