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

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-17T08:47:00Z
Last change time
2012-10-21T12:50:35Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
luka8088

Comments

Comment #0 by luka8088 — 2012-10-17T08:47:57Z
// 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)
Comment #1 by k.hara.pg — 2012-10-19T06:49:29Z
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(); }); }
Comment #2 by k.hara.pg — 2012-10-19T08:22:49Z
Comment #3 by github-bugzilla — 2012-10-21T12:47:33Z
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)