Bug 6755 – Better wrong function pointer error message

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-10-01T17:26:00Z
Last change time
2012-10-20T17:10:34Z
Keywords
diagnostic, patch
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-10-01T17:26:10Z
void bar(void function(const int) f) {} void foo(const float c) {} void main() { bar(&foo); } DMD 2.056head gives: test.d(4): Error: function test.bar (void function(const const(int)) f) is not callable using argument types (void function(const const(float) c)) test.d(4): Error: cannot implicitly convert expression (& foo) of type void function(const const(float) c) to void function(const const(int)) I'd like it to print "const(int)" or "const int" instead "const const(int)".
Comment #1 by k.hara.pg — 2011-11-19T13:51:12Z
I had already posted a patch for this issue as a part of other fix. https://github.com/D-Programming-Language/dmd/pull/429
Comment #2 by andrej.mitrovich — 2012-10-20T17:10:34Z
Seems fixed by some other pull, it's now: test.d(4): Error: function test.bar (void function(const(int)) f) is not callable using argument types (void function(const(float) c)) test.d(4): Error: cannot implicitly convert expression (& foo) of type void function(const(float) c) to void function(const(int))