October 09, 2012 Re: Using inout in delegates | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | 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 |
Copyright © 1999-2021 by the D Language Foundation