class C{ Object[] x; alias x this; string toString(){return "foo";} } void main(){writeln(new C);} // prints "[]"
Works on 2.059 PS E:\DigitalMars\dmd2\samples> rdmd bug.d foo
In 2.059, std.format module treats alias this type as proper super type. In this case, class C has explicit toString member function, so it is used. Pull request I had posted: https://github.com/D-Programming-Language/phobos/pull/488 Phobos commit: https://github.com/D-Programming-Language/phobos/commit/b90e2835eb6ca63fe58789d6f38e414f5bda70ed