Bug 7317 – writeln cannot handle alias this of array type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-19T00:52:00Z
Last change time
2012-04-19T17:24:24Z
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2012-01-19T00:52:31Z
class C{ Object[] x; alias x this; string toString(){return "foo";} } void main(){writeln(new C);} // prints "[]"
Comment #1 by lovelydear — 2012-04-19T14:28:45Z
Works on 2.059 PS E:\DigitalMars\dmd2\samples> rdmd bug.d foo
Comment #2 by k.hara.pg — 2012-04-19T17:24:24Z
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