https://issues.dlang.org/show_bug.cgi?id=13858

          Issue ID: 13858
           Summary: Wrong warning about unreachable code with break/goto
                    case
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: [email protected]
          Reporter: [email protected]

-----
void foo() { assert(0); }

void main()
{
    int x = 0;

    LSwitch: switch (x)
    {
        case 0:
            break LSwitch;

        default: return;
    }

    foo();
}
-----

$ dmd -w -run test.d
> test.d(15): Warning: statement is not reachable

However the above isn't true:
$ dmd -run test.d
> [email protected](1): Assertion failure

--

Reply via email to