July 25, 2016 [Issue 16321] New: ICE with delegate in UDA | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: ketmar@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()); } -- |
Copyright © 1999-2021 by the D Language Foundation