D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9153 - Type inference for array of delegates should not break based on order
Summary: Type inference for array of delegates should not break based on order
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-12-13 10:23 UTC by hsteoh
Modified: 2012-12-17 01:41 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 hsteoh 2012-12-13 10:23:50 UTC
import std.stdio;

version=Broken;

void main() {
        version(Broken) {
                auto tbl = [
                        (string x) { writeln(x); },
                        (string x) { x ~= 'a'; },
                ];
        } else {
                auto tbl = [
                        (string x) { x ~= 'a'; },
                        (string x) { writeln(x); },
                ];
        }
}

This code used to compile in dmd 2.058.

Commenting out "version=Broken" fixes the problem. It seems that type inference isn't being done correctly for the delegates in the array, depending on what order they appear in.
Comment 2 github-bugzilla 2012-12-17 00:05:34 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3c81eff3ea8da324698ab05bf6fd5e105762414e
fix Issue 9153 - Type inference for array of delegates should not break based on order

https://github.com/D-Programming-Language/dmd/commit/c9373834865ffe6a11e3bfae4c3507ee151cd0c0
Merge pull request #1374 from 9rnsr/fix_funclit

Issue 9153 - Type inference for array of delegates should not break based on order