Comment #0 by jarrett.billingsley — 2007-07-10T21:34:50Z
Example:
char[] Something(char[] blah)
{
char[] slice = blah[0 .. 1];
slice[0] = 'h';
return blah;
}
void main()
{
pragma(msg, Something("foo".dup));
writefln("%s", Something("foo".dup));
}
When compiled, this displays "foo"; when run, "hoo". Notice that slicing the input array and then modifying the slice is supposed to modify the original array, but it doesn't in CTFE because Slice() in the frontend always creates a copy of the data.
Comment #1 by clugdbug — 2009-12-29T00:12:38Z
*** Issue 3456 has been marked as a duplicate of this issue. ***
Comment #2 by clugdbug — 2010-04-03T11:20:23Z
*** Issue 4057 has been marked as a duplicate of this issue. ***