https://d.puremagic.com/issues/show_bug.cgi?id=12494

           Summary: to!string(enum) returns incorrect value
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from SHOO <[email protected]> 2014-03-30 11:03:23 PDT ---
This code doesn't work:
--------- main.d ---------
enum E
{
    a = 0,
    b = 0,
    c = 1,
}

void main()
{
    import std.stdio, std.conv, std.string;
    assert(format("%s", E.c) == "c"); // main(11): OK
    assert(to!string(E.c) == "c");    // main(12): NG
}

--------- RESULT ---------
$ dmd -run main
core.exception.AssertError@main(12): Assertion failure
---------

I think it is strange that to!string returns incorrect value though format
returns correct value.

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

Reply via email to