Bug 17842 – [scope] array append allows for escaping references

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-20T02:17:45Z
Last change time
2017-12-18T22:55:33Z
Keywords
safe
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2017-09-20T02:17:45Z
Reported by Mathias Lang: void main () @safe { Object o = test(); assert(o !is null); } Object test() @safe { scope Object obj = new Object; scope Object[] arr; arr ~= obj; Object[] array; array ~= arr; // should be an error return array[0]; }
Comment #1 by bugzilla — 2017-10-23T09:33:10Z
Comment #2 by github-bugzilla — 2017-10-26T12:07:10Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/a3859d9529f2505e2736e37c0ee0d8123080c90a fix Issue 17842 - [scope] array append allows for escaping references https://github.com/dlang/dmd/commit/7815bdab2df7569edfc27721fde99e82f7d0fe91 Merge pull request #7236 from WalterBright/fix17842 fix Issue 17842 - [scope] array append allows for escaping references
Comment #3 by github-bugzilla — 2017-12-18T22:55:33Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/a3859d9529f2505e2736e37c0ee0d8123080c90a fix Issue 17842 - [scope] array append allows for escaping references https://github.com/dlang/dmd/commit/7815bdab2df7569edfc27721fde99e82f7d0fe91 Merge pull request #7236 from WalterBright/fix17842