← Back to index
|
Original Bugzilla link
Bug 9894 – Member func of templated struct can't pass varargs to templated member func
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-06T19:34:00Z
Last change time
2015-06-09T01:31:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla
Comments
Comment #0
by bus_dbugzilla — 2013-04-06T19:34:17Z
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
Comment #1
by bus_dbugzilla — 2013-04-06T19:36:59Z
Note that if func2 is *NOT* a template, then it works.
Comment #2
by bus_dbugzilla — 2013-04-06T19:45:48Z
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); }
Comment #3
by k.hara.pg — 2013-04-07T02:19:47Z
*** This issue has been marked as a duplicate of issue 9885 ***