https://issues.dlang.org/show_bug.cgi?id=16972
Issue ID: 16972
Summary: Issue diagnostic for throwing from a scope(exit) block
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
void main() {
for (;;) {
// It's good that these all produce error messages. (But see issue
16971.)
// scope (exit) goto end;
// scope (exit) break;
// scope (exit) continue;
// scope (exit) return;
// Unfortunately, this does not issue any diagnostic:
scope (exit) throw new Exception("");
}
end:
}
It would be nice if the compiler produced an error message like
"throw statements cannot be in scope(exit) bodies"
Ali
--