[Issue 15290] New: length of associative array literal with duplicate keys is wrong
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Nov 5 02:28:51 PST 2015
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: nobody at puremagic.com
Reporter: schuetzm at gmx.net
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
--
More information about the Digitalmars-d-bugs
mailing list