[Issue 16972] New: Issue diagnostic for throwing from a scope(exit) block

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Dec 14 15:50:30 PST 2016


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: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

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

--


More information about the Digitalmars-d-bugs mailing list