[Issue 8729] parse!bool does not work correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 26 14:36:13 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8729



--- Comment #3 from monarchdodra at gmail.com 2012-09-26 14:36:53 PDT ---
FYI, parse!int also has the same problem. Only floating point types seem to
behave correctly:

import std.conv;
import std.stdio;

void main()
{
   auto str = "456.7 123";

   auto d = parse!double(str);
   auto i = parse!int(str);

   assert(d == 456.7);
   assert(i == 123);
}

On the split side, to! seems to parse things it should actually be rejecting:

import std.conv;
import std.stdio;

void main()
{
   auto str = "456.7 123";

   auto d = to!double(" 456.7"); //Passes, but shouldn't
   auto i = to!int(" 123"); //Correctly throws
}

Just logging here the bugs I find, still on this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list