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.