www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16633] New: Case where an alias this is tried before the

https://issues.dlang.org/show_bug.cgi?id=16633

          Issue ID: 16633
           Summary: Case where an alias this is tried before the right
                    member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

class Item
{
    alias children this;
    Item[] children;
    void populate()
    {
        children ~= new Item; // Item is seen as []
        assert(children.length == 1);
    }
}

void main()
{
    Item root = new Item;
    root.populate;
}

https://forum.dlang.org/thread/wcxdarfpfassnjaakklk forum.dlang.org

--
Oct 21 2016