[Issue 12350] New: Assigning __traits(getAttributes) to variable crashes DMD
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 12 02:49:00 PDT 2014
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 at puremagic.com
ReportedBy: tomerfiliba at gmail.com
--- Comment #0 from Tomer Filiba <tomerfiliba at 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: -------
More information about the Digitalmars-d-bugs
mailing list