convert static arrays to dynamic arrays and return, have wrong data.

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 10 06:21:53 PST 2014


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



More information about the Digitalmars-d mailing list