import std.stdio; import std.conv; struct Foo { string toString() { return to!string(x); } alias x this; int x; int y; // comment this out and the bug is gone } void main() { auto foo = Foo(); writeln(foo); } If you comment out "int y;" the bug is gone, otherwise you get back this little thingy: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) does not match any function template declaration D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) cannot deduce template function from argument types !(int)(Foo) D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\conv.d(100): Error: template instance errors instantiating template D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(1683): Error: template instance std.conv.to!(int).to!(Foo) error instantiating D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(328): instantiated from here: getNthInt!(Foo) D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(678): instantiated from here: formattedWrite!(LockingTextWriter,immutable(char),Foo) D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(1511): instantiated from here: write!(Foo,char) test.d(18): instantiated from here: writeln!(Foo) D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(328): Error: template instance std.format.getNthInt!(Foo) error instantiating D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(678): instantiated from here: formattedWrite!(LockingTextWriter,immutable(char),Foo) D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(1511): instantiated from here: write!(Foo,char) test.d(18): instantiated from here: writeln!(Foo) Failed: dmd -d -debug -w -wi -unittest -v -o- "test.d" -I"." >test.d.deps
Fixed in 2.057, but I don't know which pull fixed it.