diff tests/mini/compile_scope_exit_foreach.d @ 1411:e57859ca8f1e

Fix `scope(exit) foreach (ref v; arr) foo(v);`
author Frits van Bommel <fvbommel wxs.nl>
date Fri, 22 May 2009 21:38:01 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/mini/compile_scope_exit_foreach.d	Fri May 22 21:38:01 2009 +0200
@@ -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;
+}