On 07.12.2015 21:56, John Carter wrote:
So whilst attempt to convert from a hex string (without the 0x) to int I
bumped into the @@@BUG@@@ the size of China....
https://github.com/D-Programming-Language/phobos/blob/master/std/conv.d#L2270
Is there a bugzilla issue number tracking this?
Searching for conv and parse in the issue tracker didn't turn it up....
Is this a phobos bug or a compiler bug?
I followed the example in the unit test to get a workaround.... but I
don't understand why the workaround works!
I'm not sure if there's a bug. `parse` takes the string via `ref`, but
string literals are not lvalues so they cannot be passed that way. This
should also make it clear why the workaround works: A string literal is
not an lvalue, but a variable is.
Maybe whoever added that note thinks that string literals should be
lvalues. That would make it a compiler bug. I think that would be a
controversial viewpoint, though.
Or the author thinks that `parse` should work with non-lvalues. That
would make it a phobos issue. We have std.conv.to for that, though. So
weakening the requirements on `parse` isn't exactly necessary. Just use
`to` when you don't care about popping the input.