Bug 9615 – std.conv.parse!(T[]) fails on trailing comma

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-28T01:01:00Z
Last change time
2017-03-22T12:21:54Z
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-02-28T01:01:53Z
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 //----
Comment #1 by monarchdodra — 2013-02-28T01:12:58Z
(In reply to comment #0) > parse!(int[])(s); //Unexpected ']' when converting from type string to type > int And if you are trying to parse a string[], you'll get a "Can't parse string: """ is missing"
Comment #2 by github-bugzilla — 2017-01-26T16:43:07Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/307675ad75230efa5bd7d6c5cb4ea38b7a23694d fix issue 9615, std.conv.parse!(T[]) should allow a trailing comma https://github.com/dlang/phobos/commit/781ea571b03b1cdc3246bbea4820a4f0242d215e Merge pull request #5061 from BBasile/issue-9615 fix issue 9615, std.conv.parse!(T[]) should allow a trailing comma
Comment #3 by github-bugzilla — 2017-02-24T18:15:32Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/307675ad75230efa5bd7d6c5cb4ea38b7a23694d fix issue 9615, std.conv.parse!(T[]) should allow a trailing comma https://github.com/dlang/phobos/commit/781ea571b03b1cdc3246bbea4820a4f0242d215e Merge pull request #5061 from BBasile/issue-9615
Comment #4 by github-bugzilla — 2017-03-22T12:21:54Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/307675ad75230efa5bd7d6c5cb4ea38b7a23694d fix issue 9615, std.conv.parse!(T[]) should allow a trailing comma https://github.com/dlang/phobos/commit/781ea571b03b1cdc3246bbea4820a4f0242d215e Merge pull request #5061 from BBasile/issue-9615