possible bug in std.conv.parse

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 26 17:49:53 PDT 2014


On Sunday, 27 April 2014 at 00:04:15 UTC, ketmar wrote:
but this is definetely bug, i think:

void main() {
   import std.stdio : writeln;
   import std.conv : to;
   writeln(to!int("29a", 16)); // 666
   writeln(to!int("+29a", 16)); // Unexpected '+' when converting 
from type string base 16 to type int
   //writeln(to!int("-29a", 16)); // Unexpected '-' when 
converting from type string base 16 to type int
}


it compiles, but throws exceptions on last two lines with 
writeln(). base 10 accepts '+' and '-' though. why other bases 
aren't?


More information about the Digitalmars-d mailing list