https://issues.dlang.org/show_bug.cgi?id=16343
--- Comment #5 from Jonathan M Davis <[email protected]> --- I just hit this issue again - with an alias parameter this time. This code ============ struct S { int i; } void main() { foreach(memberName; __traits(allMembers, S)) { func!(__traits(getMember, S, memberName))(); } } void func(alias member)() { auto protection = __traits(getProtection, member); alias Type = typeof(member); auto name = __traits(identifier, member); } ============ gives this error q.d(10): Error: need 'this' for 'func' of type 'pure nothrow @nogc @safe void()' whereas moving the contents of the free function into main works just fine. The lack of ability to pass the member to a template for introspection makes it a lot harder to avoid code duplication when writing code that does type introspection. --
