www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18952] New: std.experimental.checkedint.Saturate prints

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

          Issue ID: 18952
           Summary: std.experimental.checkedint.Saturate prints integral
                    promotion deprecation message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

---
/dlang/dmd/linux/bin64/../../src/phobos/std/experimental/checkedint.d(2184):
Deprecation: integral promotion not done for ~cast(byte)0, use
'-transition=intpromote' switch or ~cast(int)(cast(byte)0)
---


---
import std.experimental.checkedint;

void main()
{
    auto x = (cast(byte) 127).checked!Saturate;
    assert(x == 127);
    x++;
    assert(x == 127);
}
---

https://run.dlang.io/is/8QMIT5

--
Jun 06 2018