D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5367 - Array of closures assign problem
Summary: Array of closures assign problem
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-12-24 00:40 UTC by bearophile_hugs
Modified: 2012-02-01 20:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-12-24 00:40:43 UTC
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++; }];
}


With DMD 2.051:

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

{

n++;

}

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


It looks like a front-end bug.
Comment 1 yebblies 2012-02-01 20:37:29 UTC
Probably fixed with the other delegate conversion bugs.