digitalmars.D.bugs - [Issue 21122] New: hasUDAs/getUDAs/getSymbolsByUDA fails on local
- d-bugmail puremagic.com (41/41) Aug 05 2020 https://issues.dlang.org/show_bug.cgi?id=21122
https://issues.dlang.org/show_bug.cgi?id=21122 Issue ID: 21122 Summary: hasUDAs/getUDAs/getSymbolsByUDA fails on local symbol UDAs with enum values Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: zan77137 nifty.com This code doesn't work: -------------------------------------- import std.traits; enum B; void main() { enum A; struct S { A int a; } enum E { A a, B b } static assert(hasUDA!(S.a, A)); // Error: undefined identifier A ... while evaluating: static assert(hasUDA!(E.a, A)); static assert(hasUDA!(E.b, B)); static assert(is(getUDAs!(S.a, A)[0] : A)); // Error: static assert: is(getUDAs!(cast(E)0, A)[0] : A) is false static assert(is(getUDAs!(E.a, A)[0] : A)); static assert(is(getUDAs!(E.b, B)[0] : B)); static assert(getSymbolsByUDA!(S, A).length == 1); // Error: static assert: 0LU == 1LU is false //static assert(getSymbolsByUDA!(E, A).length == 1); static assert(getSymbolsByUDA!(E, B).length == 1); } -------------------------------------- The following issue is similar, but the previous example succeeds in S, but fails in E. https://issues.dlang.org/show_bug.cgi?id=15335 --
Aug 05 2020