The @@@BUG@@@ the size of China - std.conv.d - Target parse(Target, Source)(ref Source s, uint radix)

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 7 14:38:03 PST 2015


On 12/7/15 5:32 PM, anonymous wrote:
> 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.

https://github.com/D-Programming-Language/phobos/commit/406bbbb9b485c01eb3afeada056ffb46924ee06b

I doubt Andrei thinks string literals should be lvalues.

It's an old bug, if it still exists. But in any case, the description is 
terrible. A real bug report should be filed.

-Steve


More information about the Digitalmars-d-learn mailing list