We can't compile this code if enable the line:26 or line:34.
----
import std.array;
import std.format;
class C1
{
const(string) var = "C1";
alias var this;
}
class C2
{
string var = "C2";
alias var this;
}
void main()
{
FormatSpec!char f;
auto a = appender!string();
auto c1 = new C1();
auto c2 = new C2();
// formatValue(a, c1, f); // line:21
/*
If enable this line,
test.d(21): Error: template std.format.formatValue(Writer,T,Char) if (is(const(T) == const(void[]))) formatValue(Writer,T,Char) if (is(const(T) == const(void[])
)) matches more than one template declaration, C:\d\dmd2\src\phobos\std\format.d(1092):formatValue(Writer,T,Char) if (isSomeString!(T) && !isStaticArray!(T)) an
d C:\d\dmd2\src\phobos\std\format.d(1346):formatValue(Writer,T,Char) if (is(T == class) && !isInputRange!(T))
*/
// formatValue(a, c2, f); // line:29
/*
If enable this line,
C:\d\dmd2\src\phobos\std\format.d(1097): Error: test.C2 cannot be sliced with []
*/
}
----
Comment #1 by k.hara.pg — 2010-12-24T16:25:08Z
Created attachment 854
fix formatValue
Comment #2 by k.hara.pg — 2010-12-24T16:40:38Z
Created attachment 855
fix formatValue
I fixed patch bug.