www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15043] New: [e2ir] dmd still crashes when trying to set a

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

          Issue ID: 15043
           Summary: [e2ir] dmd still crashes when trying to set a delegate
                    from __traits(getOverloads)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bb.temp gmx.com

the following program compiled without any particular switch

---
class Foo
{
    uint bar(){return 0;}
    this()
    {
        foreach(member; __traits(allMembers, typeof(this)))
            foreach(overload; __traits(getOverloads, typeof(this), member)) 
                static if (member == "bar")
                    setDg(&overload);
    }      
    void setDg(uint delegate() dg){}
}

void main(){}
---

crashes DMD and outputs:

 Error: delegates are only for non-static functions
 Assertion failure: '(int)vindex >= 0' on line 3439 in file 'e2ir.c'
- The bug looks highly related to https://issues.dlang.org/show_bug.cgi?id=13920. - The bug only produces a messages since 2.068, previously it was only crashing without any helpful dignostic message. --
Sep 11 2015