Bug 10118 – BigInt as associative array key wrong behavior
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-19T09:05:00Z
Last change time
2013-07-25T09:31:17Z
Keywords
pull
Assigned to
nobody
Creator
alvaro.segura
Comments
Comment #0 by alvaro.segura — 2013-05-19T09:05:16Z
Associative arrays with BigInts as keys are unusable:
import std.bigint, std.stdio;
void main()
{
int[BigInt] a;
a[BigInt(3)] = 3;
a[BigInt(3)] = 4;
writeln(a);
}
Prints:
[3:3, 3:4]
Apparently duplicate keys.
Probably related to Issue 8435.
I thought this was a consequence of Issue 3789 because BigInt is a struct containing a string. But that was resolved recently, and this bug still appears in 2.063 beta.
Issue #8435 has been fixed in git HEAD, but apparently the code in this bug is still failing, so reopening.
Comment #7 by hsteoh — 2013-07-22T19:00:45Z
Apparently, DMD commit acd073afcb89d639c8c99cd7f8233788db6036d6 broke the fix for this bug.
Comment #8 by k.hara.pg — 2013-07-23T00:01:28Z
(In reply to comment #7)
> Apparently, DMD commit acd073afcb89d639c8c99cd7f8233788db6036d6 broke the fix
> for this bug.
I opened additional compiler change to fix BigInt issue:
https://github.com/D-Programming-Language/dmd/pull/2374
Comment #9 by hsteoh — 2013-07-25T09:31:17Z
Verified fixed in dmd git HEAD. Thanks for the fast response, Kenji!!