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

          Issue ID: 24855
           Summary: VRP fails to prevent overflow after division
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Found by IchorDev:
https://forum.dlang.org/reply/[email protected]

```
void f()
{
    short x = short.max;
    short div = 1;
    short y = x / div + 1;
}
```

Expected behavior: Error that expression `x / div + 1` can't implicitly convert
to short.
Actual behavior: compiles without error.

--

Reply via email to