Bug 12350 – Assigning __traits(getAttributes) to variable crashes DMD

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-12T02:48:00Z
Last change time
2014-03-13T16:26:33Z
Keywords
ice, pull
Assigned to
nobody
Creator
tomer

Comments

Comment #0 by tomer — 2014-03-12T02:48:55Z
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); } ```
Comment #1 by k.hara.pg — 2014-03-12T06:09:50Z
Comment #2 by github-bugzilla — 2014-03-13T15:49:51Z
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