scope(faliure) flow control.

TheFlyingFiddle kurtyan at student.chalmers.se
Sat Dec 28 12:31:12 PST 2013


int foo()
{
    scope(failure) return 22;
    throw new Exception("E");
}

unittest
{
    assert(foo() == 22);
}

Is this defined behavior? At least in x64 dmd the exception is 
swallowed and the assert evaluates to true.

In any case what should happen? Should the method return or 
should the exception be propagated up the callstack?


More information about the Digitalmars-d-learn mailing list