[Issue 18290] std.conv.parse throws ConvOverflowException for negative values in hex

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 16 12:06:10 UTC 2019


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

--- Comment #5 from berni44 <bugzilla at d-ecke.de> ---
(In reply to Răzvan Ștefănescu from comment #4)
> Just to play dumb, taking your advice to put a "-" before:
> parse!int("-80000000", 16) returns 0 :)

OK, thanks. This makes for a much better test:

---
void main()
{
    import std.conv;

    string s = "-80000000";
    assert(parse!int(s,16) == int.min);
}
---

Currently the assertion fails.

A similar problem arises with to!int("-80000000,16), which produces an
Exception. With the radix 10 this works, all other radices fail.

--


More information about the Digitalmars-d-bugs mailing list