www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7317] New: writeln cannot handle alias this of array type

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7317

           Summary: writeln cannot handle alias this of array type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



class C{
    Object[] x;
    alias x this;
    string toString(){return "foo";}
}
void main(){writeln(new C);} // prints "[]"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7317


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
Works on 2.059

PS E:\DigitalMars\dmd2\samples> rdmd bug.d
foo

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7317


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012