http://d.puremagic.com/issues/show_bug.cgi?id=9651
Ivan Kazmenko <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://d.puremagic.com/issu | |es/show_bug.cgi?id=4451 --- Comment #1 from Ivan Kazmenko <[email protected]> 2013-03-05 12:05:11 PST --- Interestingly, a local array and a delegate do generate a warning. However, the warning says "escaping reference to local variable a" which is not true: the problem lies in escaping reference to a local unnamed slice, not variable "a" which is legally visible to the caller. The non-ref versions compile and run without problems. Example 3 (local fixed length array): ----- import std.stdio; void main () { int [1] a; ref int [] f () { return a [0..1]; } auto s = f (); writeln (s); } ----- Example 4 (local variable length array): ----- import std.stdio; void main () { int [] a; ref int [] f () { return a [0..1]; } a = new int [1]; auto s = f (); writeln (s); auto t = f (); writeln (t); } ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
