Re: Local pointer escape under current DIP1000 implementation

2017-05-05 Thread Andrei Alexandrescu via Digitalmars-d

On 5/5/17 12:51 PM, Yuxuan Shui wrote:

Code:

@safe auto id(scope int *p) {
 int*[] a;
 a ~= p;
 return a;
}
@safe int *bar() {
 int i;
 return id()[0]; //pointer to local escaped
}

Compiles with -dip1000


Cool, thanks. Will discuss with Walter right now. Looks like an 
oversight - the append is not supposed to go through. -- Andrei


Local pointer escape under current DIP1000 implementation

2017-05-05 Thread Yuxuan Shui via Digitalmars-d

Code:

@safe auto id(scope int *p) {
int*[] a;
a ~= p;
return a;
}
@safe int *bar() {
int i;
return id()[0]; //pointer to local escaped
}

Compiles with -dip1000