Bug 4337 – Associative array assignment with dstring keys breaks lookup

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-06-16T23:34:00Z
Last change time
2012-03-23T04:40:54Z
Keywords
wrong-code
Assigned to
nobody
Creator
Justin.SpahrSummers

Comments

Comment #0 by Justin.SpahrSummers — 2010-06-16T23:34:22Z
void main () { int[dstring] foo; foo = [ "hello"d : 5 ]; assert("hello"d in foo); } This assertion fails on dmd 2.047 on OS X. Using foo["hello"d] = 5; or changing the key type to string works.
Comment #1 by Justin.SpahrSummers — 2010-06-16T23:36:37Z
(In reply to comment #0) > void main () { > int[dstring] foo; > > foo = [ > "hello"d : 5 > ]; > > assert("hello"d in foo); > } > > This assertion fails on dmd 2.047 on OS X. Using foo["hello"d] = 5; or changing > the key type to string works. Forgot to add that the keys and values are still iterable with foreach() - it's just lookup by hash (index or "in" syntax) that fails.
Comment #2 by repeatedly — 2010-11-06T13:35:24Z
I hit this bug when I wrote a Japanese language morphological analysis library (http://bitbucket.org/repeatedly/scrap/src/tip/tinysegmenter.d). I voted.
Comment #3 by braddr — 2011-02-06T15:40:34Z
Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.
Comment #4 by yebblies — 2012-02-02T23:48:21Z
Most likely a druntime string comparison issue.
Comment #5 by hsteoh — 2012-03-13T22:40:40Z
This bug appears to be the same as bug 7512, which has been fixed in git. Please verify.
Comment #6 by yebblies — 2012-03-23T04:40:54Z
*** This issue has been marked as a duplicate of issue 7512 ***