September 20, 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@puremagic.com
          Reporter: bugzilla@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];
}

--