July 13, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
July 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: -------