Bug 22065 – std.container.array: compiler allows Array as the key of an associative array but this does not work properly

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-22T11:19:46Z
Last change time
2021-06-29T22:44:12Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.
Depends on
22075

Comments

Comment #0 by n8sh.secondary — 2021-06-22T11:19:46Z
Equality and hashing are inconsistent for std.container.array.Array leading to incorrect behavior when an Array is used as the key of an associative array. --- void main() { import std.container.array : Array; int[Array!int] aa; auto a = Array!int(1, 2, 3); aa[a] = 9; assert(aa[a] == 9); // Passes. auto b = Array!int(1, 2, 3); assert(a == b); // Passes. assert(aa[b] == 9); // Fails: range violation. } ---
Comment #1 by dlang-bot — 2021-06-22T12:45:32Z
@n8sh created dlang/phobos pull request #8150 "std.container.array: compiler allows Array as key of associative array but this does not work properly" fixing this issue: - Fix Issue 22065 - std.container.array: compiler allows Array as key of associative array but this does not work properly https://github.com/dlang/phobos/pull/8150
Comment #2 by n8sh.secondary — 2021-06-29T22:44:12Z
*** This issue has been marked as a duplicate of issue 22075 ***