On 10/14/16 4:49 PM, Nick Sabalausky wrote:
This compiles. Is it supposed to?

@safe ubyte[] foo()
{
    ubyte[512] buf;
    auto slice = buf[0..$];
    // Escaping reference to stack memory, right?
    return slice;
}

Yes, this still is a problem, but Walter has a fix in the works.

https://issues.dlang.org/show_bug.cgi?id=8838

This one is also fun:

ubyte[512] foo();

ubyte[] x = foo(); // compiles, but never is correct. Ever.

https://issues.dlang.org/show_bug.cgi?id=12625

-Steve

Reply via email to