www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.conv.parse of string literals

reply bearophile <bearophileHUGS lycos.com> writes:
This is a small D2 program that uses parse:

import std.conv: parse;
void main() {
    parse!int("111");
    parse!int("111");
}


Gives the error:
std.conv.ConvError: std.conv(1122): Can't convert value `' of type string base
2 to type int

But a string literal isn't a lvalue. This seems all wrong.

In Bugzilla there are related bugs about strings. Do you think this is worth
another bugzilla entry?

Bye and thank you,
bearophile
Sep 09 2010
parent reply Andrej Mitrovic <none none.none> writes:
This might be related to that bug report you wrote where you could
assign one string literal to another.

bearophile Wrote:

 
 But a string literal isn't a lvalue. This seems all wrong.
Sep 09 2010
parent bearophile <bearophileHUGS lycos.com> writes:
Andrej Mitrovic:
 This might be related to that bug report you wrote where you could
 assign one string literal to another.
Right. And recently there's another similar bug report in Bugzilla. So I may add this case just to one of those bug reports. Bye, bearophile
Sep 09 2010