www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12817] New: pure nothrow text(BigInt) too

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

          Issue ID: 12817
           Summary: pure nothrow text(BigInt) too
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

In dmd 2.066alpha this compiles and runs:


void main() pure nothrow {
    import std.conv: text;
    int x = 10;
    assert(text(x) == "10");
}


While thios:

void main() pure nothrow {
    import std.bigint: BigInt;
    import std.conv: text;
    BigInt x = 10;
    assert(text(x) == "10");
}


temp.d(5,16): Error: pure function 'D main' cannot call impure function
'std.conv.text!(BigInt).text'
temp.d(5,16): Error: 'std.conv.text!(BigInt).text' is not nothrow
temp.d(1,6): Error: function 'D main' is nothrow yet may throw

--
May 28 2014