view 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 source

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;
}