[Issue 18644] [dip1000] escape of outer local not detected
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 21 08:23:10 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18644
Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |issues.dlang at jmdavisProg.co
| |m
--- Comment #1 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
Shouldn't the error be that
int* foo() { return &i; }
is trying to convert scope int* to int* in @safe code? Unless foo isn't
inferred as @safe in spite of it being declared in an @safe function, but if
that's the case, then calling foo should be an error, since otherwise, an @safe
function would be calling an @system function without @trusted being involved.
Certainly, given the fact that foo() returns int*, I don't see how
int*[] b = [foo()]; // should detect error
is invalid. It's only dealing with int*. So, there's no escaping as far is that
bit of code is concerned.
--
More information about the Digitalmars-d-bugs
mailing list