Skip to content

Commit

Permalink
Merge pull request #250 from 9rnsr/fix6609
Browse files Browse the repository at this point in the history
Issue 6609 - std.conv.parse!Integer should consider sign when radix == 10
  • Loading branch information
dsimcha committed Sep 10, 2011
2 parents 9328e95 + c07dc78 commit c16f64c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions std/conv.d
Expand Up @@ -2003,6 +2003,9 @@ in
}
body
{
if (radix == 10)
return parse!Target(s);

immutable length = s.length;
immutable uint beyond = (radix < 10 ? '0' : 'a'-10) + radix;

Expand Down Expand Up @@ -2075,6 +2078,9 @@ unittest
assert(parse!int(s, 8) == octal!765);
s = "fCDe";
assert(parse!int(s, 16) == 0xfcde);

// 6609
assert(parse!int("-42", 10) == -42);
}

Target parse(Target, Source)(ref Source s)
Expand Down

0 comments on commit c16f64c

Please sign in to comment.