struct Foo(TArgs...) { void func(TArgs args) { func2(args); } void func2()(TArgs args) {} } void main() { Foo!(int).func(5); } DMD output: test.d(2): Error: template test.Foo!(int).Foo.func2 does not match any function template declaration. Candidates are: test.d(3): test.Foo!(int).Foo.func2()(TArgs args) test.d(2): Error: template test.Foo!(int).Foo.func2()(TArgs args) cannot deduce template function from argument types !()(int) test.d(7): Error: template instance test.Foo!(int) error instantiating
Note that if func2 is *NOT* a template, then it works.
Workaround: struct Foo(TArgs...) { void func(TArgs args) { this.workaround(args); } void func2()(TArgs args) {} } void workaround(Struct, TArgs...)(Struct s, TArgs args) { s.func2!()(args); } void main() { Foo!(int) f; f.func(5); }
*** This issue has been marked as a duplicate of issue 9885 ***