false positive escaping reference to local array

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Wed May 6 00:28:29 PDT 2015


Hi all,

Please consider the following program:
void main() {
     int array[13];

     int[] internalFunc() {
         return array;
     }
}

This code does not compile (dmd 2.066.1), claiming:
test.d(5): Error: escaping reference to local array

The way I see it, the array in question is in scope anywhere the 
function is, and as such, this error is a false positive.

Thoughts?

Shachar


More information about the Digitalmars-d mailing list