[Issue 18644] [dip1000] escape of outer local not detected
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 21 08:29:35 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18644
--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Jonathan M Davis from comment #1)
> int i;
> int* foo() { return &i; }
should behave like:
int* foo(int* p) { return p; }
and then the error is detected:
int*[] b = [foo(&i)];
The [ ] puts things on the heap, where they escape.
--
More information about the Digitalmars-d-bugs
mailing list