How to assign a delegate to a var ?

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 3 11:06:12 PDT 2014


On Tuesday, 3 June 2014 at 15:14:06 UTC, bioinfornatics wrote:
> without using a delegate, with a function that will not work as
>  (int a) => a == 42 is a delegate no ?

D will decide the type based on if context is needed. If you look 
at the output you had:

     , __ctmp1474).this(function (int a) => a == 42).predicate

Inside this, you'll see that your lambda was identified as a 
function. I'm guessing that having the function assigned to a 
delegate has confused the compiler which is why segfault.

I think such should be filed as a bug, likely should not have 
compiled.


More information about the Digitalmars-d-learn mailing list