I use this heavily to iterate module-level functions[1]. import std.traits; struct UDA; @UDA void foo() {} void main() { alias funs = getSymbolsByUDA!(mixin(__MODULE__), UDA); } > C:\cygwin\home\zorael\work\result\bin\..\import\std\traits.d(8356): Error: template instance `isAggregateType!(uda)` does not match template declaration `isAggregateType(T)` > uda.d(10): while looking for match for `getSymbolsByUDA!(uda, UDA)` Offending commit: commit f07517ac648a933d998bc6a53af7dc55c9d48daf Author: The Dlang Bot <code+dlang-bot@dawg.eu> Date: Wed Jul 10 11:57:39 2019 +0200 phobos: Merge pull request #7100 from RazvanN7/fix_issue_19105 https://github.com/dlang/phobos/pull/7100 Fix Issue 19105 - Bogus recursive template expansion via getSymbolsByUDA merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com> [1]: https://github.com/zorael/kameloso/blob/25cee1b7/source/kameloso/plugins/common.d#L955
The fix implemented for issue 19105 is just plain wrong, as the issue isn't fixed: import std.traits; struct A(Args...) {} struct S1 { // Recursive template expansion alias C = A!( getSymbolsByUDA!(S1, A) ); } struct S2 { // precompute the result: alias tmp = getSymbolsByUDA!(S2, A); // No recursive template expansion alias C = A!( getSymbolsByUDA!(S2, A) ); } Reduced test case: template test(alias T) { enum i = __traits(compiles, __traits(getMember, T, "C")); alias test = int; } struct A(Args...) {} struct S1 { // Recursive template expansion alias C = A!(test!S1); } struct S2 { // No error alias a = test!S2; alias C = A!(test!S2); }
@Biotronic updated dlang/phobos pull request #7158 "Revert "Fix Issue 19105 - Bogus recursive template expansion via getS…" fixing this issue: - Fix issue 20054 - getSymbolsByUDA no longer works on modules https://github.com/dlang/phobos/pull/7158
*** Issue 20188 has been marked as a duplicate of this issue. ***
dlang/phobos pull request #7158 "Revert "Fix Issue 19105 - Bogus recursive template expansion via getS…" was merged into stable: - 2a2018cf34e8b410f40be53c6068b84121888af7 by Simen Kjærås: Fix issue 20054 - getSymbolsByUDA no longer works on modules https://github.com/dlang/phobos/pull/7158