Bug 4429 – .keys for V[real] broken

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-07-05T07:53:00Z
Last change time
2010-07-06T04:38:40Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-07-05T07:53:57Z
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 }
Comment #1 by bearophile_hugs — 2010-07-05T09:38:57Z
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.
Comment #2 by schveiguy — 2010-07-06T04:38:40Z
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 ***