[Issue 4451] New: Escaping reference to local array error for slices
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 13 01:38:12 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4451
Summary: Escaping reference to local array error for slices
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid, diagnostic
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-07-13 01:38:09 PDT ---
A D2 program that currently (dmd v2.047) compiles:
int[] foo() {
int[10] stackArray;
int[] dynArray = stackArray[1 .. 5];
return dynArray;
}
void main() {}
In this case the compiler can give an error like:
Error: escaping reference to local arr
Like the one given with the code:
int[] foo() {
int[10] arr;
return arr;
}
void main() {}
Currently (dmd v2.047) even this compiles:
int[] foo() {
int[10] arr;
return arr[];
}
void main() {}
--
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