JS asked about this in the main group, but here is more appropriate and I'm quite interested myself.

Can someone explain the rationale behind this:

class A
{
    auto a = (){};              //Lambda not allowed
    auto b = function(){};      //Function allowed
    auto c = delegate(){};      //Delegate not allowed
}

A guess:

Delegate's aren't allowed as members due their context pointer (why???), lambdas are assumed to be delegates unless they are proved to not need context (and dmd is sucking at proving that).

Reply via email to