digitalmars.D.bugs - [Issue 12576] New: problem with compile time struct field
- d-bugmail puremagic.com (48/48) Apr 13 2014 https://issues.dlang.org/show_bug.cgi?id=12576
https://issues.dlang.org/show_bug.cgi?id=12576 Issue ID: 12576 Summary: problem with compile time struct field Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: ellery-newcomer utulsa.edu the code: 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 mix = Replace!(" ReturnType Func(Params) { return Mangled(args); }\n", "Func", cf.funcname); return mix; } enum Mixins = CppClass1!("X", typeof(new class { })); the fireworks: $ dmd error1 error1.d(9): Error: template instance NextAt!("\x0a ReturnType Func(Params) {\x0a return Mangled(args);\x0a }\x0a", "", -1, "Func", funcname) cannot use local 'funcname' as parameter to non-global template NextAt(string base, string longest_spec, ulong _at0, T...) error1.d(20): Error: template instance error1._CppFunction.Replace!("\x0a ReturnType Func(Params) {\x0a return Mangled(args);\x0a }\x0a", "Func", funcname) error instantiating error1.d(28): instantiated from here: CppClass1!("X", __anonclass1) --
Apr 13 2014