Array of closures assign

bearophile bearophileHUGS at lycos.com
Thu Dec 23 00:57:24 PST 2010


This D2 program compiles with no errors:

void delegate()[1] foo;
void main() {
    int n;
    foo[0] = { n++; };
}


But this one:

void delegate()[1] foo;
void main() {
    int n;
    foo[] = [{ n++; }];
}



test.d(4): Error: cannot implicitly convert expression ([delegate void()

{

n++;

}

]) of type void delegate()[] to const(void delegate()[])

Is this a front-end bug?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list