Initializing global delegate variable - bug or on purpose?

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 25 13:54:28 PDT 2016


int delegate(int) dg = (i) => i * 2;

Error: non-constant nested delegate literal expression __lambda3


int delegate(int) dg;

static this() {
    dg = i => i * 2; // ok
}


Am I doing anything wrong?

Atila


More information about the Digitalmars-d-learn mailing list