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

--- Comment #0 from 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:
------- You are receiving this mail because: -------

Reply via email to