scope(failure) compiles but is not called if it inside of block
Denis Feklushkin
feklushkin.denis at gmail.com
Thu Jan 31 20:05:31 UTC 2019
code: https://run.dlang.io/is/GgQjfV
/++ dub.sdl:
name "ttest"
description "test"
+/
import std.stdio;
import std.exception;
void main()
{
scope(failure) writeln("1");
{
scope(failure) writeln("2"); // compiles but is not
called for some reason
}
scope(failure) writeln("3");
enforce(false); // throws exception
}
Outpupt:
Running ./ttest
3
1
object.Exception at bitop_bt.d(19): Enforcement failed
More information about the Digitalmars-d
mailing list