Re: Escaping ref to stack mem sometimes allowed in @safe?

2016-10-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 14, 2016 16:49:44 Nick Sabalausky via Digitalmars-d-learn 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; > } > > Or is the escaping

Re: Escaping ref to stack mem sometimes allowed in @safe?

2016-10-16 Thread Steven Schveighoffer via Digitalmars-d-learn
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.