https://d.puremagic.com/issues/show_bug.cgi?id=12350

           Summary: Assigning __traits(getAttributes) to variable crashes
                    DMD
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: tomerfil...@gmail.com


--- Comment #0 from Tomer Filiba <tomerfil...@gmail.com> 2014-03-12 02:48:55 
PDT ---
DMD hangs forever when compiling this code (I have to kill it with a signal)

```
enum MyUDC;

struct MyStruct {
    int a;
    @MyUDC int b;
}

void testAttrs(T)(const ref T strct) if (is(T == struct)) {
    foreach(name; __traits(allMembers, T)) {
        // this works
        enum index = staticIndexOf!(MyUDC, __traits(getAttributes,
__traits(getMember, strct, name)));

        // this works
        auto tr = __traits(getAttributes, __traits(getMember, strct,
name)).stringof;

        // this crashes DMD 2.065
        auto tr = __traits(getAttributes, __traits(getMember, strct, name));
        // as well as this
        enum tr = __traits(getAttributes, __traits(getMember, strct, name));

        enum index = staticIndexOf!(MyUDC, tr);
    }
}

void main() {
    MyStruct s;
    testAttrs(s);
}
```

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to