https://issues.dlang.org/show_bug.cgi?id=17477

Nick Treleaven <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Nick Treleaven <[email protected]> ---
> This is wrong, as the argument type is not (void).

The type of a template is void. A lambda without parameter types is a template.
When a template lambda doesn't implicitly convert to the expected parameter
type, it's not established what the type of the implicitly instantiated lambda
is, as it failed to instantiate.

> It is also very difficult to figure out what is wrong with this program from 
> this error (when the code is far more complicated).

The fix for issue #10602 gives:

/home/nick/old/lambdaarg.d(16): Error: function `lambdaarg.f(void delegate(int)
nothrow dlg)` is not callable using argument types `(void)`
/home/nick/old/lambdaarg.d(16):        cannot implicitly convert expression
`__lambda2` of type `void delegate(int x) @system` to `void delegate(int)
nothrow`

Note the inferred argument type that the compiler tried on the second line.

--

Reply via email to