digitalmars.D.bugs - [Issue 4451] New: Escaping reference to local array error for slices
- d-bugmail puremagic.com (38/38) Jul 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4451
- d-bugmail puremagic.com (8/8) Jul 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4451
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 puremagic.com
ReportedBy: bearophile_hugs eml.cc
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: -------
Jul 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4451
bearophile_hugs eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 13 2010








d-bugmail puremagic.com