Always. But the check seems very simple, and is easily circumvented. This compiles:byte[] func() { byte[1024] buffer; auto p = buffer[0..3]; return p; }
I think this is the first step of a long and difficult way. byte[] func(byte[] a) { return a[0..1]; } byte[] func1() { byte[1024] buffer; return func(buffer[1...$]); } byte[] func2() { static byte[1024] buffer; return func(buffer[1..$]); }