May 08, 2004 out/inout array function parameter in foreach | ||||
---|---|---|---|---|
| ||||
Any access to out/inout array function parameters in class foreach statement causes AV. [code] class A { int m = 0; int opApply(int delegate(inout int) dg) { return dg(m); } } void foo(out int[] q, A a) { q = new int[10]; foreach(inout int e; a) { q[0] = 0; // access violation here! } } void main() { int[] a; foo(a, new A); } [/code] |
Copyright © 1999-2021 by the D Language Foundation