https://issues.dlang.org/show_bug.cgi?id=12576
--- Comment #1 from Kenji Hara <k.hara...@gmail.com> --- Is this a possible workaround for your 'original' code? I'm not sure it's the actual issue, because the code still fail to compile. template Replace(string base, T...) { template NextAt(string base, string longest_spec, size_t _at0, T...) { } NextAt!(base,"",-1,T) N; } struct _CppFunction { string funcname; } string CppClass1(string name, Clazz)() { enum _CppFunction cf = { }; enum x = cf.funcname; // <--- workaround? enum mix = Replace!(" ReturnType Func(Params) { return Mangled(args); }\n", "Func", /*cf.funcname*/x); // <--- workaround? return mix; } enum Mixins = CppClass1!("X", typeof(new class { })); --