www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2579] New: Template function accepting a delegate with in argument doesn't compile

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2579

           Summary: Template function accepting a delegate with in argument
                    doesn't compile
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: snake.scaly gmail.com


The following code:

void foo(T)(T delegate(in Object) dlg)
{
}

void bar()
{
  foo( (in Object) { return 15; } );
}

does not compile:

 dmd -c bug_template_in.d
bug_template_in.d(7): template bug_template_in.foo(T) does not match any function template declaration bug_template_in.d(7): template bug_template_in.foo(T) cannot deduce template function from argument types !()(int delegate(const(Object) _param_0)) Replacing both instances of 'in Object' with 'const(Object)' makes the code compile. I think these two forms are equivalent and should both compile. --
Jan 10 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2579


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |k.hara.pg gmail.com


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-07-14 04:25:09 PDT ---
https://github.com/D-Programming-Language/dmd/pull/111

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2579


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2011-08-24
17:29:57 PDT ---
https://github.com/D-Programming-Language/dmd/commit/706d7c721974a443625f5bc1ed11d73a360faf80

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