Thread overview
[Issue 7821] New: std.conv.to is broken for enums
Apr 04, 2012
Andrej Mitrovic
Apr 04, 2012
Andrej Mitrovic
Apr 05, 2012
yebblies
April 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7821

           Summary: std.conv.to is broken for enums
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-04 11:29:28 PDT ---
import std.conv;

enum Tag
{
     A
    ,AB
}

void main()
{
    Tag tag1 = to!Tag("A");   // ok
    Tag tag2 = to!Tag("AB");  // fail
}

ConvException: Unexpected 'B' when converting from type string to type Tag

It appears if you have an enum field name that begins with another field's name std.conv.to fails to parse it. This is a blocker for me.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7821



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-04 11:31:55 PDT ---
(In reply to comment #0)
> This is a blocker for me.

OK not a blocker, I can implement a simple template function that converts strings to fields.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7821


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #3 from yebblies <yebblies@gmail.com> 2012-04-05 10:39:37 EST ---
*** This issue has been marked as a duplicate of issue 4744 ***

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