Bug 7201 – Lambda template assignment to variable

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-02T09:54:00Z
Last change time
2012-01-03T11:22:38Z
Keywords
patch
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-01-02T09:54:34Z
In DMD 2.058head the compiler accepts a function template as argument for the foo() function: void foo(int function(int x) g) {} void main() { foo((x) => 0); // OK } So I think it should accept an assignment too: void main() { int function(int x) f; f = (x) => 0; // Error } Currently it gives: test.d(3): Error: __lambda4 has no value
Comment #1 by k.hara.pg — 2012-01-02T16:54:53Z
I've already post a pull to support inference on AssignExp. https://github.com/D-Programming-Language/dmd/pull/593
Comment #2 by bearophile_hugs — 2012-01-03T11:22:38Z