https://issues.dlang.org/show_bug.cgi?id=13501
--- Comment #6 from Vladimir Panteleev <[email protected]> --- I can understand such limitations being present for scope(exit), but not for scope(success). scope(success) blocks are trivially lowered by inserting code before all returns (or other statements that normally leave the scope), so they should not in principle be special as far as exceptions are concerned. If the problem is generally about throwing while an exception is in flight, I feel like this is too useful to give up at the point, because error recovery in principle may be a non-trivial operation that itself may throw. > The spec is correct here, and the compiler should deprecate throwing in the > scope statement. Such a deprecation would need to be about any and all nothrow code, not just throw statements, which would be a major breaking change. It would, at least, break the pattern: foreach (foo; foos) { scope(failure) stderr.writeln("Error while processing foo" , foo, ":"); processFoo(foo); } because the writeln may throw. --
