This bug seems to apply no matter what V is, but only applies when the key is a real, not a float or a double. import std.stdio; void main() { uint[real] foo; foo[3.14159265] = 1; foo[2.71828182] = 2; foo[6.66] = 3; writeln(foo); // Works writeln(foo.keys); // 6.66 -0 -0 }
Bugs happen, it's life. But this is silly. Phobos/druntime must be designed differently, with a more serious amount of unittests: a bug as simple as this one must be found during development of Phobos/druntime, and not by language users because the code is written in an amateurish way.
I think the keys member is horribly broken if the size of the key isn't size_t. I'll add an appropriate comment to 4201 to indicate reals also are a problem. *** This issue has been marked as a duplicate of issue 4201 ***