[Issue 17842] New: [scope] array append allows for escaping references
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 20 02:17:45 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17842
Issue ID: 17842
Summary: [scope] array append allows for escaping references
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
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];
}
--
More information about the Digitalmars-d-bugs
mailing list