import std.stdio; alias Sample = inter!q{ void sample(); }; void main(){} template inter(string a){ enum inter = { struct Dummy{mixin(a);} foreach(member_name; __traits(allMembers, Dummy)){ if(member_name != `this`){ pragma(msg, "WHYYYY ", member_name != `this`); } } return 0; }(); } output: WHYYYY true WHYYYY false version: DMD32 D Compiler v2.096.0-dirty
What output are you expecting/ (In reply to Menshikov Konstantin from comment #0) > if(member_name != `this`){ Did you mean to use "static if" instead of "if"?
Nested structs have a hidden 'this' pointer to the enclosing context. It seems isn't that hidden after all.