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: [email protected]
Reporter: [email protected]
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];
}
--