[Issue 4744] New: std.conv: string->enum doesn't look for longer match

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 27 23:04:47 PDT 2010


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

           Summary: std.conv: string->enum doesn't look for longer match
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: rsinfu at gmail.com
        ReportedBy: rsinfu at gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-08-27 23:04:37 PDT ---
parse!enum(string) must look for a longer match.

--------------------
import std.conv;
unittest
{
    enum E { aa, aaZ, aaaZ }
    assert(to!E("aaaZ") == E.aaaZ);
}
void main() {}
--------------------
% dmd -unittest -run test
std.conv.ConvError: std.conv(684): Can't convert value `Z' of type
const(char)[] to type E

-- 
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