Bug 6609 – std.conv.parse!Integer should consider sign when radix == 10
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-06T00:37:00Z
Last change time
2011-10-13T23:05:36Z
Keywords
patch
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2011-09-06T00:37:54Z
Following code
import std.conv;
void main() {
parse!int("-42", 10);
}
causes exception in runtime:
std.conv.ConvException@C:\dmd2\src\phobos\std\conv.d(2045): Can't convert value `-42' of type string base 10 to type int
I think the leading sign character should be considered when radix equals to 10.