https://issues.dlang.org/show_bug.cgi?id=22271

--- Comment #7 from deadalnix <[email protected]> ---
(In reply to Vladimir Panteleev from comment #6)
> It would be a breaking change.
> 
> ///////////// test.d /////////////
> string fun() @safe
> {
>     immutable char[3] arr = "foo";
>     string s = arr[];
>     string r;
>     r ~= s;
>     return r;
> }
> //////////////////////////////////

I don't think this is a reasonable expectation that there is duplication here.
If you want it heap allocated, you ought to call dup/idup.

After all, it does it the other way around:
> string fun(string stuff)
> {
>     immutable char[3] arr = "foo";
>     string s = arr[];
>     return s ~ stuff;
> }

This is all good and well, until stuff is an empty array, in which case it is
not anymore.

--

Reply via email to