The docs for template mixins do show mixins inside functions, so is this a bug, or is there something else I'm doing wrong?

//**************************
module main;
import std.traits;

class ModInfo {

}

mixin template moduleInfo(alias MODULE) {
        static const(ModInfo) __module_info = new ModInfo;
}

const(ModInfo) getModuleInfo(alias mod)() {
        static if(__traits(hasMember, mod, "__module_info")) {
                return __traits(getMember, mod, "__module_info");
        } else {
                mixin moduleInfo!mod;      // ERROR [1]
                return __module_info;
        }
}

void main() {
        static const(ModInfo) info = getModuleInfo!(main);
}
//**************************

[1] main.d(17,3): Error: Declaration mixin moduleInfo!(main);
 is not yet implemented in CTFE
main.d(23,31):        called from here: getModuleInfo()

Reply via email to