[Issue 16321] New: ICE with delegate in UDA
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jul 25 08:07:01 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16321
Issue ID: 16321
Summary: ICE with delegate in UDA
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ketmar at ketmar.no-ip.org
the following code gives
Internal error: backend/cgcod.c 1666
in 2.071 and master:
struct NameAttribute {
int delegate () foo;
}
static NameAttribute getNamedAttribute(alias S) () {
NameAttribute res;
foreach (attr; __traits(getAttributes, S)) {
static if (is(typeof(attr) == NameAttribute)) res = attr;
}
return res;
}
struct MyStruct {
@NameAttribute({ return 42; }) int a;
}
void PrintAll(T) (T arg) {
foreach (m; __traits(allMembers, T)) {
enum nameAttr = getNamedAttribute!(__traits(getMember, T, m));
}
}
void main () {
PrintAll(MyStruct());
}
--
More information about the Digitalmars-d-bugs
mailing list