https://issues.dlang.org/show_bug.cgi?id=21694
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: [email protected]
Reporter: [email protected]
struct A { ~this() {} }
void test(int x)
{
{
A a;
goto END;
}
A b;
END:
}
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
code;
- 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).
--