Comment #0 by bus_dbugzilla — 2010-03-20T12:15:03Z
------------------------------
import std.stdio;
void main()
{
int i;
auto arr = [
i,
__LINE__,//xxx, // Expected number of this line
i
]; // Outputs this line number
writeln(arr[1]);
}
------------------------------
void main()
{
int i;
auto arr = [
i,
xxx, // Error should be reported here
i
]; // Error actually reported here
}
------------------------------
The above problem holds for both arrays and assoc arrays. Problem does not occur for array literals or assoc array literals.
This is a real pain for a particular idiom I find very useful, particularly for handling domain-specific languages:
------------------------------
auto dgMap = [
"foo": (Foo f) {
return /+..stuff..+/;
},
"bar": (Foo f) {
return /+..stuff..+/;
},
"bat": (Foo f) {
return /+..stuff..+/;
},
];
dgMap["bar"](new Foo())
------------------------------
Issue #977 is a special case of this issue.
Comment #1 by yebblies — 2012-02-01T18:58:42Z
Same issue - array initializers get the wrong locations assigned.
*** This issue has been marked as a duplicate of issue 977 ***