https://issues.dlang.org/show_bug.cgi?id=15290

          Issue ID: 15290
           Summary: length of  associative array literal with duplicate
                    keys is wrong
           Product: D
           Version: D2
          Hardware: x86_64
               URL: http://forum.dlang.org/thread/rlxkowykiacokdxkehra@for
                    um.dlang.org
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

void main()
{
    import std.stdio : writeln;
    ["key": 10, "key" : 20, "key" : 30].length.writeln;
    ["key" : 30].length.writeln;
}

This prints:
3
1

In general, duplicate keys in literals should probably be disallowed anyway:
https://issues.dlang.org/show_bug.cgi?id=11637

--

Reply via email to