digitalmars.D.bugs - out/inout array function parameter in foreach
- Sark7 (20/20) May 08 2004 Any access to out/inout array function parameters in class 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]
May 08 2004