Fix scope(exit) foreach (ref v; arr) foo(v);

This commit is contained in:
Frits van Bommel
2009-05-22 21:38:01 +02:00
parent 59f9b35cea
commit adfc5b3ee9
2 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
module scope_exit_foreach;
void bar(size_t);
long foo(ubyte[] arr) {
scope(exit) {
foreach (ref b; arr) {
bar(b);
}
}
if (arr.length == 3)
return 0;
return arr.length;
}