www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8029] New: Untyped delegate literal and template issue

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: johnch_atms hotmail.com



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: -------
May 04 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8029


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 9393 ***

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