digitalmars.D - Attack of the implicit convertion
- Julio César Carrascal Urquijo <Julio_member pathlink.com> Jul 26 2005
- Ba Ding Chee <Ba_member pathlink.com> Jul 26 2005
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Jul 27 2005
The following code produces an unexpected compile error:
private import std.string;
void main()
{
std.string.toString(cast(dchar)'a');
}
test1.d(135): function std.string.toString called with argument types:
(dchar)
matches both:
std.string.toString(char)
and:
std.string.toString(creal)
¿creal? ¿Why does it match creal?
Jul 26 2005
test1.d(135): function std.string.toString called with argument types: (dchar) matches both: std.string.toString(char) and: std.string.toString(creal) ¿creal? ¿Why does it match creal?
the letter ‘i's in them. ;)
Jul 26 2005
"Julio César Carrascal Urquijo" <Julio_member pathlink.com> wrote in message news:dc719n$1th5$1 digitaldaemon.com...test1.d(135): function std.string.toString called with argument types: (dchar) matches both: std.string.toString(char) and: std.string.toString(creal) ¿creal? ¿Why does it match creal?
This error message is quite confusing. It's because there is no toString() overload for wchar or dchar. You have to cast to char to use toString. I don't really get why it thinks creal is a match, though.
Jul 27 2005









Ba Ding Chee <Ba_member pathlink.com> 