[Issue 1654] Array concatenation should result in mutable or invariant depending on usage

Janice Caron caron800 at googlemail.com
Wed Mar 26 13:27:43 PDT 2008


On 26/03/2008, d-bugmail at puremagic.com <d-bugmail at puremagic.com> wrote:
>  Of course a NewExpression would also return a unique reference:

That doesn't follow. Counterexample follows:

    char[1000] globalBuffer;

    class S
    {
        char[] buffer;

        this(int n)
        {
            buffer = globalBuffer[0..n];
        }
    }

   invariant(S) s = new S(4); // not valid

This is harder than you think! :-)


More information about the Digitalmars-d-bugs mailing list