https://issues.dlang.org/show_bug.cgi?id=12729
Issue ID: 12729 Summary: mixins don't work in traits Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: vlevenf...@gmail.com const bool has_attribute (T, string member, alias attribute) () { // ok mixin( `foreach (type; __traits (getAttributes, T.`~member~`))` `static if (is (type == attribute))` `return true;` ); // ok foreach (type; mixin(`__traits (getAttributes, T.`~member~`)`)) static if (is (type == attribute)) return true; // doesn't compile, member is not accessible error foreach (type; __traits (getAttributes, mixin(`T.`~member))) static if (is (type == attribute)) return true; return false; } --