[Issue 21122] __traits(getAttributes) wrong scope on enums

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 5 13:07:57 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21122

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com
            Summary|hasUDAs/getUDAs/getSymbolsB |__traits(getAttributes)
                   |yUDA fails on local symbol  |wrong scope on enums
                   |UDAs with enum values       |

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Reduced:

unittest {
    enum A;
    enum E { @A a }

    pragma(msg, getAllUDAs!(E.a));
}

alias getAllUDAs(A...) = __traits(getAttributes, A);

By introducting a symbol A at module scope we can even have getAllUDAs return
the wrong thing. Obviously it's looking up things in the wrong scope.

--


More information about the Digitalmars-d-bugs mailing list