Lambda return type bug?

Lodovico Giaretta via Digitalmars-d digitalmars-d at puremagic.com
Mon May 2 01:09:47 PDT 2016


Hi,

I think this code should work, but the compiler does not agree.
Am I missing something?

void main()
{
     alias funType = void function(int x);
     funType fun = (x) => { assert(x); };   // cannot return 
non-void from void function
     fun(0);
}

 From the language reference I understand that assert shoud return 
void, so I can't see how this code is wrong.


More information about the Digitalmars-d mailing list