Thread overview
[Issue 8836] New: function called with argument types ((void function())) matches both f(void function() fn) and f(void delegate() dg)
Oct 17, 2012
luka8088
Oct 19, 2012
Kenji Hara
Oct 19, 2012
Kenji Hara
Oct 21, 2012
Walter Bright
October 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8836

           Summary: function called with argument types ((void
                    function())) matches both f(void function() fn) and
                    f(void delegate() dg)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: luka8088@owave.net


--- Comment #0 from luka8088 <luka8088@owave.net> 2012-10-17 08:47:57 PDT ---
// http://dpaste.dzfl.pl/92347e75

import std.stdio;

void f (void function () fn) {}
void f (void delegate () dg) {}

void main () {
  f({ writeln("f"); });
}

-----

Compilation output:

/home/c713/c345.d(8): Error: function c345.f called with argument types:
((void function()))
matches both:
/home/c713/c345.d(4): c345.f(void function() fn)
and:
/home/c713/c345.d(5): c345.f(void delegate() dg)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-10-19 06:49:29 PDT ---
Reduced test case:

int f(void function () fn) { return 1; }
int f(void delegate () dg) { return 2; }

void foo() {}  // unsafe, impure, and may throw
void main()
{
    f({ foo(); });
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-10-19 08:22:49 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1193

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8836



--- Comment #3 from github-bugzilla@puremagic.com 2012-10-21 12:47:33 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/b927f9875086428f76137247409859a99e2b867c
fix Issue 8836 - function called with argument types ((void function()))
matches both f(void function() fn) and f(void delegate() dg)

https://github.com/D-Programming-Language/dmd/commit/c639d6248a081aeed89bfbda1c4be367e91fc1da Merge pull request #1193 from 9rnsr/fix8836

Issue 8836 - function called with argument types ((void function())) matches
both f(void function() fn) and f(void delegate() dg)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8836


Walter Bright <bugzilla@digitalmars.com> changed:

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


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