[Issue 6934] [CTFE] can't use $ in a slice of an array passed by ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 19 12:25:43 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6934



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2011-11-19 12:24:51 PST ---
In fact passing arrays by reference is broken in non-trivial cases.

Changing the test case to include an index or slice assignment reveals
wrong-code problems:

void bar6934(ref int[] p) {
    p[0] = 12;
    assert(p[0] == 12); // fails!!!
    p[0..1] = 17;
    assert(p[0] == 17); // fails!!! 
    p = p[1..$];
}

This applies to any complicated passing of an array by ref (any dotvar or index
expression, or combination thereof).
It applies to array index assignment, and slice assignment.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list