www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18142] New: checkedint opOpAssign doesn't accept a checkedint

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

          Issue ID: 18142
           Summary: checkedint opOpAssign doesn't accept a checkedint
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dhasenan gmail.com

Test case:

---
import std.experimental.checkedint;
void main()
{
    alias cint = Checked!(int, Throw);
    cint a = 10;
    cint b = 10;
    b += a;
}
---

Actual result:
  Error: 'b += a' is not a scalar, it is a Checked!(int, Throw)

Expected result: the example should compile, and b shoulod get the value 20.

--
Dec 29 2017