cannot implicitly convert char[] to string
cym13 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Aug 15 04:34:00 PDT 2015
On Saturday, 15 August 2015 at 11:25:20 UTC, vladde wrote:
> I made a PR to phobos where I modified `std.format.format`.
> https://github.com/D-Programming-Language/phobos/pull/3528
>
> However the auto builder fails, with the error message:
>> runnable/test23.d(1219): Error: cannot implicitly convert
>> expression (format("s = %s", s)) of type char[] to string
>
> The line which fails is `p = std.string.format("s = %s", s);`
>
> I don't understand why I can't convert a char[] to string.
I think it has to do with the fact that string is an alias to
immutable(char)[] and you can't implicitely cast an immutable
to a regular variable.
More information about the Digitalmars-d-learn
mailing list