Bug 8029 – Untyped delegate literal and template issue
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-04T02:14:00Z
Last change time
2013-04-23T01:13:11Z
Assigned to
nobody
Creator
johnch_atms
Comments
Comment #0 by johnch_atms — 2012-05-04T02:14:01Z
The compiler doesn't seem to be able to infer the type for a delegate literal which is used as an argument to a function template inside a class template.
struct Test(T) {
void run(U)(U delegate(T) dg) {}
}
void main() {
Test!string test;
test.run((p) { return 12; });
// test.run(p => 12); // This also fails
}
error : undefined identifier T, did you mean template to(T)?
error : template Test!(string).Test.run does not match any function template declaration
error : template Test!(string).Test.run(U) cannot deduce template function from argument types !()(void)
Comment #1 by k.hara.pg — 2013-04-23T01:13:11Z
*** This issue has been marked as a duplicate of issue 9393 ***