[Issue 4451] Escaping reference to local array error for slices
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Aug 27 03:16:39 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=4451
Nemanja Boric <4burgos at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |4burgos at gmail.com
--- Comment #1 from Nemanja Boric <4burgos at gmail.com> ---
This can lead to the subtle bugs like:
import std.stdio;
int[] foo(int val)
{
int[10] array;
array[0] = val;
return array[];
}
void main()
{
auto val = foo(1);
auto val2 = foo(2);
writeln(val[0]); // Prints 2
}
--
More information about the Digitalmars-d-bugs
mailing list