www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18024] New: checkedint should be usable in safe nothrow pure

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

          Issue ID: 18024
           Summary: checkedint should be usable in  safe nothrow pure
                     nogc
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

void main(string[] args)  safe  nogc nothrow pure
{
     import std.experimental.checkedint : checked;
     auto f = (2.checked + 3).get;
}


foo.d(4): Error: pure function 'D main' cannot call impure function
'std.experimental.checkedint.Checked!(int, Abort).Checked.opBinary!("+",
int).opBinary'
foo.d(4): Error:  safe function 'D main' cannot call  system function
'std.experimental.checkedint.Checked!(int, Abort).Checked.opBinary!("+",
int).opBinary'
foo.d(4): Error:  nogc function 'D main' cannot call non- nogc function
'std.experimental.checkedint.Checked!(int, Abort).Checked.opBinary!("+",
int).opBinary'
foo.d(4): Error: function std.experimental.checkedint.Checked!(int,
Abort).Checked.opBinary!("+", int).opBinary is not nothrow

--
Dec 01 2017