[Issue 5042] format("%s") of struct without toString
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 24 18:41:49 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5042
--- Comment #3 from bearophile_hugs at eml.cc 2012-04-24 18:42:50 PDT ---
In dmd 2.060alpha:
import std.stdio: writeln, writefln;
import std.string: format;
struct Foo { int x; }
void main() {
writeln(Foo(1)); // ==> Foo(1)
writefln("%s", Foo(1)); // ==> Foo(1)
writeln(format("%s", Foo(1))); // run-time error
}
I see this error still:
Foo(1)
Foo(1)
std.format.FormatException at std\format.d(4749): Can't convert test.Foo to
string: "string toString()" not defined
If it's isn't a problem in just my DMD, then I'll reopen this issue...
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list