https://issues.dlang.org/show_bug.cgi?id=17545
--- Comment #2 from monkeywork...@hotmail.com --- If you don't want to modify the enum the following code also seems to work. The main thing is to avoid using __traits(getMember) which could get passed a non-symbol. module example; import std.meta: staticIndexOf; import std.traits; struct Attrib {} @Attrib enum TEST = 123; void foo() { foreach(sym; getSymbolsByUDA!(example, Attrib)) { pragma(msg, sym.stringof); //Prints 123 } } The fact that it prints 123 instead of TEST seems to suggest that it is indeed a problem with the compiler pasting the value where the identifier is used. I'd recommend taking a look at the implementation of getSymbolsByUDA to see how it's done there. --