[Issue 15043] [e2ir] dmd still crashes when trying to set a delegate from __traits(getOverloads)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 13 19:37:01 UTC 2018


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

Basile B. <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice                         |diagnostic
             Status|REOPENED                    |NEW

--- Comment #4 from Basile B. <b2.temp at gmx.com> ---
The code now leads to a wrong diagnostic

"/tmp/temp_7FECD0F3D050.d(9,27): Error: delegates are only for non-static
functions"

but on the other hand this works

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

void main(){}

--


More information about the Digitalmars-d-bugs mailing list