October 09, 2012
On 2012-10-08 21:40, Timon Gehr wrote:

> The original behaviour is to be expected and the workaround exploits a
> compiler bug.
>
> The correct way to get rid of the compile error is:
>
> void foo(inout(int)[] arr){
>      auto a = { const b = arr[0]; } // or int b = arr[0];
> }

Why can't "auto" work there? BTW, this doesn't work:

void foo (inout(int)[] arr)
{
    auto a = {
        foreach (int e ; arr) {}
    };
}

-- 
/Jacob Carlborg
1 2
Next ›   Last »