view tests/mini/bug308_double_finally.d @ 1578:1dee66f6ec0b

Removed a chunk of code in favour of a shorter and more portable method
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 11:21:30 +0100
parents f9285cf14c0d
children
line wrap: on
line source

extern(C) int printf(char*, ...);

long foo(ref int p) {
    try { return 0; }
    finally {
        p++;
        throw new Object;
    }
}

void main() {
    int p = 0;
    try {
        foo(p);
        assert(0);
    } catch {
    }
    printf("Number of types scope(exit) was executed : %d\n", p);
    assert(p == 1);
}