Escaping ref to stack mem sometimes allowed in @safe?

Nick Sabalausky via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 14 13:49:44 PDT 2016


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 reference detection not intended to be 100%? Or 
something else I'm missing?

Should I file @ bugzilla?


More information about the Digitalmars-d-learn mailing list