Bug 4638 – Regression: new writeln does not recognize "wstring toString"
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-08-12T20:38:00Z
Last change time
2010-11-16T13:06:54Z
Assigned to
rsinfu
Creator
lio+bugzilla
Comments
Comment #0 by lio+bugzilla — 2010-08-12T20:38:35Z
In 2.047, a struct could provide a toString that returned a wstring (as opposed to string) and it would get used when passing the struct to writeln.
As of 2.048 a toString returning wstring is not detected and the struct's typename is returned instead. toString returning string works fine.
Repro:
import std.stdio;
import std.conv;
struct A
{
wstring toString() { return "blah"; }
}
void main()
{
A a;
writeln(a);
writeln(to!string(a));
writeln(to!wstring(a));
}
DMD 2.047:
blah
blah
blah
DMD 2.048:
A
blah
blah