[Issue 9615] New: std.conv.parse!(T[]) fails on trailing comma

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 28 01:02:05 PST 2013


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

           Summary: std.conv.parse!(T[]) fails on trailing comma
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2013-02-28 01:01:53 PST ---
The D syntax (AFAIK) allows a trailing comma at the end of a list, for the sake
of convenience, eg:

int a = 
[
    1,
    2,
    3,
];

(This *is* legal, right, it's not an accepts invalid?)

In any case, this code is currently legal, but std.conv.pase rejects it:

//----
    int[] arr = [1, 2,];   //LEGAL
    string s  = "[1, 2,]"; //*SHOULD* work
    parse!(int[])(s); //Unexpected ']' when converting from type string to type
int
//----

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