Bug 17790 – [scope] Escaping pointer possible through array of aggregates

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-28T10:02:39Z
Last change time
2017-10-16T09:57:34Z
Keywords
safe
Assigned to
No Owner
Creator
Mathias Lang

Comments

Comment #0 by mathias.lang — 2017-08-28T10:02:39Z
Compile with -dip1000, the following compiles but shouldn't: ``` struct Foo { int* p; } void main () @safe { int* ptr = bar().p; assert(ptr !is null); } Foo bar () @safe { int i; Foo[] arr = [ Foo(&i) ]; return arr[0]; } ```
Comment #1 by bugzilla — 2017-08-30T05:50:32Z
Comment #2 by github-bugzilla — 2017-08-31T13:28:49Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/66d203585f3f12dc4e3b56dc1178bebbedc1f1ba fix Issue 17790 - [scope] Escaping pointer possible through array of aggregates
Comment #3 by github-bugzilla — 2017-10-16T09:57:34Z
Commit pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/66d203585f3f12dc4e3b56dc1178bebbedc1f1ba fix Issue 17790 - [scope] Escaping pointer possible through array of aggregates