On 11/10/14 3:29 AM, Don wrote:
The problem is, that you need to be able to take a slice of a stack-allocked array (otherwise stack allocated arrays are useless). Eg you should be able to pass a slice of a stack array to writefln(). Detecting if the slice is returned, requires flow analysis. Currently the front-end doesn't do any flow analysis at all, except for a couple of special cases like closures and super() calls.
While all of that is true, the OP's code should be rejected. It returns a static array as a dynamic array in one expression.
-Steve