Using inout in delegates
Jacob Carlborg
doob at me.com
Thu Oct 4 06:49:48 PDT 2012
void foo (inout int[] arr)
{
auto a = { auto b = arr[0]; };
}
void main ()
{
auto a = [3, 4, 5];
foo(a);
}
Compiling the above code with DMD 2.060 results in the following error
message:
Error: variable main.foo.__lambda1.b inout variables can only be
declared inside inout functions
Failed: /Users/jacob/.dvm/bin/dvm-current-dc -v -o-
'/Users/jacob/development/d/main.d' -I'/Users/jacob/development/d'
>/Users/jacob/development/d/main.d.deps
Is this a bug, a limitation of inout/delegate or am I doing something
else wrong?
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list