[Issue 8029] New: Untyped delegate literal and template issue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 4 02:12:51 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8029

           Summary: Untyped delegate literal and template issue
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: johnch_atms at hotmail.com


--- Comment #0 from johnch_atms at hotmail.com 2012-05-04 02:14:01 PDT ---
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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list