On 03/28/2013 09:34 AM, Jacob Carlborg wrote:
The following code fails to compile:void foo (inout int[] arr) { auto dg = { foreach (i, e ; arr) {} }; dg(); } void main () { auto a = [3, 4, 5]; foo(a); } Error message: main.d(9): Error: variable main.foo.__lambda1.__aggr1174 inout variables can only be declared inside inout functions main.d(9): Error: variable main.foo.__lambda1.e inout variables can only be declared inside inout functions If I remove the delegate everything compiles. Am I doing something wrong?
It is a bug / problem with inout's design.
