www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12831] New: assert incorrectly fails on to!float conversion

https://issues.dlang.org/show_bug.cgi?id=12831

          Issue ID: 12831
           Summary: assert incorrectly fails on to!float conversion
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: mk krej.cz

import std.conv;

void main()
{
    float a = 1.234f;
    float b = to!float("1.234");
    assert (a == b);
    assert (a == to!float("1.234")); //fails
}

DMD32 D Compiler v2.066-devel-38c5c36

Works in gdc. Also works with real.

--
May 31 2014