Bug 3994 – Wrong line numbers inside AA/Array initializers

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Windows
Creation time
2010-03-20T12:15:00Z
Last change time
2014-04-18T09:12:03Z
Keywords
diagnostic, wrong-code
Assigned to
nobody
Creator
bus_dbugzilla
Blocks
977

Comments

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 ***