On Saturday, 9 August 2014 at 11:51:06 UTC, Idan Arye wrote:
If that was the case, the error would have said it's illegal to
throw from "finally or scope bodies". The fact that it
specifically specifies `scope(exit)` and `scope(success)` and
leave out `scope(failure)` means that whoever wrote that error
message made a conscious decision that it's OK to return in
`scope(failure)`.
DMD src/statement.c:3621 says:
if (sc->os && sc->os->tok != TOKon_scope_failure)
error("return statements cannot be in %s bodies",
Token::toChars(sc->os->tok));
So `scope(failure)` is explicitly exempted from the check.