www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22249] New: std.experimental.checkedint: Warn.onLowerBound

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

          Issue ID: 22249
           Summary: std.experimental.checkedint: Warn.onLowerBound does
                    not compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of Phobos 2.097.2, attempting to compile any program that uses
`std.experimental.checkedint.Warn.onLowerBound` fails, with the following
error:

---
/usr/include/dmd/phobos/std/experimental/checkedint.d(1619): Error: undefined
identifier `Lhs`, did you mean alias `Rhs`?
/usr/include/dmd/phobos/std/experimental/checkedint.d(1279): Error: template
instance `std.experimental.checkedint.Warn.onLowerBound!(int, byte)` error
instantiating
---

Example program:

---
import std.experimental.checkedint;

byte foo(byte a, byte b) {
    auto c = a.checked;
    c += b;
    return c.get;
}
---

--
Aug 29 2021