This code runs on ideone: http://ideone.com/iSBBO But not here, 32 bit, Linux, dmd 2.058 with: /usr/include/d/std/conv.d(101): Error: template std.format.formatValue(Writer,T,Char) if (is(Unqual!(T) == bool)) formatValue(Writer,T,Char) if (is(Unqual!(T) == bool)) matches more than one template declaration, /usr/include/d/std/format.d(1342):formatValue(Writer,T,Char) if (!isSomeString!(T) && isDynamicArray!(T)) and /usr/include/d/std/format.d(1978):formatValue(Writer,T,Char) if (!isSomeString!(T) && (is(T == struct) || is(T == union)))
I got same error as you on linux 64 with ldc2 and dmdfe 2.058
Don't link to an external site, because it may be disappear in the future. Instead write code directly, or attach the testcase, please. > http://ideone.com/iSBBO import std.string; import std.stdio; struct S { ubyte[] metadata; string toString(){ return "%s".format( metadata ); } } struct Foo { S[] bar; alias bar this; string toString(){ return "%s".format( bar ); } } void main(){ S s; s.metadata = [0,1,2]; Foo foo; foo.bar = [s]; writeln( foo ); }
https://github.com/D-Programming-Language/phobos/pull/473
This test case with 2.059head does not raise errors, but std.format still has an issue. Reduced test case: struct Foo { int[] bar; alias bar this; } void main() { import std.format; import std.array; auto w = appender!string(); FormatSpec!char f; Foo foo; formatValue(w, foo, f); // OK formatValue(w, Foo(), f); // NG }
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/9583a25fdb03a2f5187e06af6e703e03419a130f added tests for bug 7628
Pull request: https://github.com/D-Programming-Language/phobos/pull/473 Merged commit: https://github.com/D-Programming-Language/phobos/commit/b01e60f7195336e79dbe9e0aeef2925041d7f99b
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/1c1e5887b28f713ac627aa5d986f8294414e7692 added tests for bug 7628