[Issue 9831] Error message with failed lambda inference
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 17 05:34:50 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9831
--- Comment #5 from bearophile_hugs at eml.cc 2013-11-17 05:34:46 PST ---
(In reply to comment #3)
> What makes you think the first case is valid?
>
> void main() {
> immutable int c; // immutable local variable
> int function(int x) func;
> func = x => c; // needs context to access c
> }
>
> What exactly would you expect to happen?
Right, I was wrong, sorry.
(In reply to comment #4)
> 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
Thank you, the new error message is good and helps me avoid similar mistakes.
--
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