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

          Issue ID: 16644
           Summary: final switch on int should error unless VRP matches
                    all cases
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

To determine whether all cases are handled, we could use value range
propagation.

OK

final switch (i % 2)
{
case 0:
case 1:
}

ERROR
final switch (i % 3)
{
case 0:
case 1:
}

In cases where we don't know the range, it should be an error.

--

Reply via email to