digitalmars.D.bugs - [Issue 17477] New: DMD error message for delegate with wrong
- via Digitalmars-d-bugs (30/30) Jun 07 2017 https://issues.dlang.org/show_bug.cgi?id=17477
https://issues.dlang.org/show_bug.cgi?id=17477 Issue ID: 17477 Summary: DMD error message for delegate with wrong attributes is very confusing Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: eyal weka.io When compiling this invalid program: void f(void delegate(int) nothrow dlg) {} void main() { void g(int x) {} f((x){ g(x); }); } The error reported is: Error: function f (void delegate(int) nothrow dlg) is not callable using argument types (void) This is wrong, as the argument type is not (void). It is also very difficult to figure out what is wrong with this program from this error (when the code is far more complicated). A better error would be: Error: function f expects (void delegate(int) **nothrow** dlg) but was given (void delegate(int)) --
Jun 07 2017