http://d.puremagic.com/issues/show_bug.cgi?id=3994

           Summary: Wrong line numbers inside AA/Array initializers
           Product: D
           Version: 1.050
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: cbkbbej...@mailinator.com
            Blocks: 977


--- Comment #0 from Nick Sabalausky <cbkbbej...@mailinator.com> 2010-03-20 
12:15:03 PDT ---
------------------------------
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to