Bug 14238 – DIP25: escape checks can be circumvented with delegate

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-02T20:59:00Z
Last change time
2017-01-16T23:26:40Z
Keywords
accepts-invalid, pull, safe
Assigned to
nobody
Creator
schuetzm

Comments

Comment #0 by schuetzm — 2015-03-02T20:59:11Z
The following code compiles with the -dip25 switch: alias Fn = ref int delegate(); ref int foo(scope Fn fn) { return fn(); } ref int bar() { int x; ref int baz() { return x; } return foo(&baz); } void main(string[] args) { import std.stdio; int x; writefln("&x = %s", &x); int* p = &bar(); writefln("p = %s", p); } Output: &x = 7FFFF64F0728 p = 7FFFF64F0708 As can be seen, `p` points to a location further down the stack.
Comment #1 by bugzilla — 2016-06-30T05:39:37Z
The problem here is that 'scope' is not implemented.
Comment #2 by bugzilla — 2016-08-23T02:11:46Z
Comment #3 by github-bugzilla — 2016-11-01T10:35:05Z
Commit pushed to scope at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7c3e47a20e30672653c6330edbe22f2181a1f9c2 fix Issue 14238 - DIP25: escape checks can be circumvented with delegate
Comment #4 by github-bugzilla — 2016-12-31T18:15:32Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7c3e47a20e30672653c6330edbe22f2181a1f9c2 fix Issue 14238 - DIP25: escape checks can be circumvented with delegate
Comment #5 by github-bugzilla — 2017-01-07T03:02:32Z
Commit pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7c3e47a20e30672653c6330edbe22f2181a1f9c2 fix Issue 14238 - DIP25: escape checks can be circumvented with delegate
Comment #6 by github-bugzilla — 2017-01-16T23:24:07Z
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7c3e47a20e30672653c6330edbe22f2181a1f9c2 fix Issue 14238 - DIP25: escape checks can be circumvented with delegate