Issue 9605 - std.conv.parse!(string, string) fails
Summary: std.conv.parse!(string, string) fails
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-27 03:52 UTC by monarchdodra
Modified: 2024-12-01 16:16 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description monarchdodra 2013-02-27 03:52:47 UTC
Basically, std.conv.parse!(string, string) expects the string to be in the form of an array of chars:

//----
import std.conv;

void main()
{
  string s1 = `[['h', 'e', 'l', 'l', 'o'], ['w', 'o', 'r', 'l', 'd']]`;
  string s2 = `["hello", "world"]`;
  string s3 = `['h', 'e', 'l', 'l', 'o']`;
  string s4 = `"hello"`;

  auto ss1 = parse!(string[])(s1);
  auto ss2 = parse!(string[])(s2);
  auto ss3 = parse!(string  )(s3);
  auto ss4 = parse!(string  )(s4); //Can't parse string: "[" is missing
  return;
}
//----

The irony though is that if you place the string inside an array (s1 and s2), then conv will actually support both forms of parse.
Comment 1 Andrej Mitrovic 2014-04-24 18:43:53 UTC
Hmm.. Can this be fixed without breaking code?
Comment 2 Berni44 2021-02-07 11:15:13 UTC
(In reply to Andrej Mitrovic from comment #1)
> Hmm.. Can this be fixed without breaking code?

All bug fixes break codes that rely on that bug...
Comment 3 dlangBugzillaToGithub 2024-12-01 16:16:39 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9599

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB