www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16972] New: Issue diagnostic for throwing from a scope(exit)


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

void main() {
    for (;;) {
        // It's good that these all produce error messages. (But see issue
        // 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("");


It would be nice if the compiler produced an error message like

  "throw statements cannot be in scope(exit) bodies"


Dec 14 2016