Anonymous function syntax

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 22 07:32:25 PDT 2011


On 9/22/11 9:17 AM, Jacob Carlborg wrote:
>>> void foo (int delegate (int, int) a){}
>>>
>>> void main ()
>>> {
>>> foo((a, b) { return a +b;});
>>> }
>>>
>>> Results in:
>>>
>>> main.d(48): Error: undefined identifier a
>>> main.d(48): Error: undefined identifier b
>>> main.d(48): Error: function main.foo (int delegate(int, int) a) is not
>>> callable using argument types (_error_ delegate(_error_, _error_))
>>> main.d(48): Error: cannot implicitly convert expression (__dgliteral1)
>>> of type _error_ delegate(_error_, _error_) to int delegate(int, int)
>>> Failed: /Users/jacob/.dvm/bin/dvm-current-dc -v -o-
>>> '/Users/jacob/development/d/main.d' -I'/Users/jacob/development/d'
>>> >/Users/jacob/development/d/main.d.deps
>>
>> That's a bug in the compiler.
>>
>> Andrei
>
> Ok, has that been reported?

Yes :o). http://d.puremagic.com/issues/show_bug.cgi?id=6714

Andrei


More information about the Digitalmars-d mailing list