June 27, 2004 mysterious "cannot implicitly convert int to bit" | ||||
---|---|---|---|---|
| ||||
Walter, thanks for fixing "Internal Error ..\ztc\cod1.c 2244".
With that compiler bug fixed, I've progressed farther and now I've found another odd problem.
/* ********** bad.d ********** */
import std.string;
class StdString
{
private import std.string;
alias std.string.toString toString;
}
void main()
{
int i = 123;
StdString g = new StdString();
printf("%.*s\n", g.toString(i)); /* line 13 */
}
This is the perplexing error message:
main.d(13): cannot implicitly convert int to bit
What "bit"? Who asked for a bit?
The following similar (but simplified) code works fine:
/* ok.d */
import std.string;
void main()
{
int i = 123;
printf("%.*s\n", toString(i));
}
Diplays:
123
I've tested these on DMD 0.94 (WinXP).
--
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
|
Copyright © 1999-2021 by the D Language Foundation