struct Foo { extern (C) void function (int*) func; } struct Bar { static string code () { string code; foreach (symbol; __traits (allMembers, typeof(this))) static if (is(typeof(__traits (getMember, typeof(this), symbol)))) {} return code; } extern (C) void function (int*) func; mixin(code); } struct Baz { static string code () { string code; foreach (symbol; __traits (allMembers, typeof(this))) static if (is(typeof(__traits (getMember, typeof(this), symbol)))) {} return code; } mixin(code); extern (C) void function (int*) func; } void main () { static assert (functionLinkage!(typeof(Foo.func)) == `C`); static assert (functionLinkage!(typeof(Bar.func)) == `C`); static assert (functionLinkage!(typeof(Baz.func)) == `D`); // BUG why? }