[Issue 9831] Error message with failed lambda inference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 17 05:17:22 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=9831


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

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


--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-11-17 05:17:18 PST ---
(In reply to comment #0)
> void main() {
>     immutable int c;
>     int function(int x) func;
>     func = x => c;
> }
> 
> DMD 2.063alpha gives the error:
> 
> temp.d(4): Error: cannot infer function literal type from int function(int x)

I can agree that the current error message does not have so many information,
but

> But I expect an error similar to other cases of unfit lambdas, similar to:
> 
> test.d(4): Error: cannot implicitly convert expression (__lambda1) of type int
> delegate(int) nothrow pure @safe to int function(int).

the op code should produce "__lambda1 cannot access frame of function D main"
error, because required type is function pointer, not delegate.

https://github.com/D-Programming-Language/dmd/pull/2798

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list