https://issues.dlang.org/show_bug.cgi?id=15335
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from [email protected] --- I've encountered a similar issue yesterday. It looks like the only way to solve this is to make `getSymbolsByUDA` a mixin template containing the current function. Then when the template is mixed in the local scope, there's no more fake warning in case when a private member is accessed (even in "friends" classes or struct, so inside the same module. For example in my case I finished with this: --- mixin template ScopedReachability() { bool isMemberReachable(T, string member)() if (is(T==class) || is(T==struct)) { return __traits(compiles, __traits(getMember, T, member)); } } --- If I mix ScopedReachability where `isMemberReachable` has to be used it works. Previously, calling the function template was leading to the same error message that's reported here... ...So, back to real topic, by analogy: --- mixin template ScopedgetSymbolsByUDA { template getSymbolsByUDA(alias symbol, alias attribute) { import std.typetuple : Filter, staticMap, TypeTuple; static enum hasSpecificUDA(alias S) = hasUDA!(S, attribute); alias StringToSymbol(alias Name) = Identity!(__traits(getMember, symbol, Name)); alias getSymbolsByUDA = Filter!(hasSpecificUDA, TypeTuple!(symbol, staticMap!(StringToSymbol, __traits(allMembers, symbol)))); }} --- should work. Instead of calling the template, you first mix `ScopedgetSymbolsByUDA` and then you call the `getSymbolsByUDA` that's local. Of course this is not a workaround that I propose here. I think this should be done like this in phobos. --
