[Issue 13920] New: DMD crash when trying to set a delegate from __traits(getOverloads)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 1 03:18:15 PST 2015


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

          Issue ID: 13920
           Summary: DMD crash when trying to set a delegate from
                    __traits(getOverloads)
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bb.temp at gmx.com

import std.stdio;

struct get{}
struct set{}

mixin template attrAna(){

    private void Ana()
    {
        foreach(m; __traits(allMembers, typeof(this)))
            foreach(o; __traits(getOverloads, typeof(this), m))    
                foreach(attr; __traits(getAttributes, o))
                    static if (is(attr == get)){
                        o;
                        auto ICE = &o; //comment = no crash  
                    }            
    }
}

class Foo{
    mixin attrAna;
    this(A...)(A a){Ana;}
    private uint _prop;
    public @get uint propA(){writeln("o");return _prop;}
    public @set void propA(uint aValue){_prop = aValue;}
}

void main(string args[]){
    auto foo = new Foo;
}

Maybe related to 9552

--


More information about the Digitalmars-d-bugs mailing list