Bug 9153 – Type inference for array of delegates should not break based on order

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-13T10:23:00Z
Last change time
2012-12-17T01:41:05Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2012-12-13T10:23:50Z
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 #1 by k.hara.pg — 2012-12-13T19:22:03Z
Comment #2 by github-bugzilla — 2012-12-17T00:05:34Z
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