www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12350] New: Assigning __traits(getAttributes) to variable crashes DMD

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: tomerfiliba gmail.com


--- Comment #0 from Tomer Filiba <tomerfiliba 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: -------
Mar 12 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12350


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-03-12 06:09:50 PDT ---
https://github.com/D-Programming-Language/dmd/pull/3376

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12350



--- Comment #2 from github-bugzilla puremagic.com 2014-03-13 15:49:51 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/28837fe168ff2f742e92f17730930a4927b3f4be
fix Issue 12350 - Assigning __traits(getAttributes) to variable crashes DMD

https://github.com/D-Programming-Language/dmd/commit/85220de7459ec29b0a8bd88caee06c90a1b3cab9
Merge pull request #3376 from 9rnsr/fix12350

Issue 12350 - Assigning __traits(getAttributes) to variable crashes DMD

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 13 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12350


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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