On Saturday, 6 July 2019 at 09:56:57 UTC, ag0aep6g wrote:
On 06.07.19 01:12, Patrick Schluter wrote:
On Friday, 5 July 2019 at 23:08:04 UTC, Patrick Schluter wrote:
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven
wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
[...]
and it cannot optimize it away because it doesn't know what
the caller want to do with it. It might in another module
invoke it and modify it, the compiler cannot tell. auto a=f();
a[0]++;
f returns immutable. typeof(a) is immutable(int[]). You can't
do a[0]++.
You're right, I shouldn't post at 1 am.