Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
March 21, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |safe -- |
March 21, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 Jonathan M Davis <issues.dlang@jmdavisProg.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dlang@jmdavisProg.co | |m --- Comment #1 from Jonathan M Davis <issues.dlang@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. -- |
March 21, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> --- https://github.com/dlang/dmd/pull/8062 -- |
March 21, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 --- Comment #3 from Walter Bright <bugzilla@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. -- |
March 22, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 --- Comment #4 from github-bugzilla@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/51565f362fd318ceb0cf94519819c3232b1adb22 fix Issue 18644 - [dip1000] escape of outer local not detected https://github.com/dlang/dmd/commit/0e0df72c1d3b70cb2f1a7fb2f6b26ac7bb8dcc39 Merge pull request #8062 from WalterBright/fix18644 fix Issue 18644 - [dip1000] escape of outer local not detected -- |
March 22, 2018 [Issue 18644] [dip1000] escape of outer local not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18644 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
Copyright © 1999-2021 by the D Language Foundation