------- Comment #4 from  2009-02-19 03:27 -------
(In reply to comment #3)
> It reallocated array on increasing length. Seems valid.

Yes, the length part is fine. Here is slightly modified test case:

import std.stdio;
import std.algorithm;

void main()
        immutable(int)[] x = [1, 5, 3, 4];
        auto y = x;

        writefln(y); // immutable variable is modified!

Problem is that sort and reverse work in-place, thus modifying immutable
variable. It should either not compile /or/ allocate a copy. I don't like the
hidden allocations, so this should be just disallowed, imo.


Reply via email to