www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21694] New: Misleading error message and invalid goto error


          Issue ID: 21694
           Summary: Misleading error message and invalid goto error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: rumbu rumbu.ro

struct A { ~this() {} }

void test(int x)
      A a;
      goto END;
   A b;


Error: cannot `goto` into `try` block

I know that behind the scenes the code above will end in two imbricated
try/finally blocks because of RAII, but:
- the error message is misleading, there is no finally block in the original
- this is a legal goto equivalent with a return which should be allowed, it's
not like jumping in a middle of another scope (which also shows the same
misleading error message).

Mar 09 2021