www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8836] New: function called with argument types ((void function())) matches both f(void function() fn) and f(void delegate() dg)

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



// 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: -------
Oct 17 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

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



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: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8836


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

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



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: -------
Oct 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8836




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


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: -------
Oct 21 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Oct 21 2012