D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6609 - std.conv.parse!Integer should consider sign when radix == 10
Summary: std.conv.parse!Integer should consider sign when radix == 10
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-09-06 00:37 UTC by Kenji Hara
Modified: 2011-10-13 23:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011-09-06 00:37:54 UTC
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.