www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13920] New: DMD crash when trying to set a delegate from

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 puremagic.com
          Reporter: bb.temp 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

--
Jan 01 2015