Bug 5292 – Associative array with fixed sized array as value issues a Range violation when inserting new value

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2010-11-30T15:17:00Z
Last change time
2011-01-23T12:52:24Z
Assigned to
sean
Creator
chatelet.guillaume

Comments

Comment #0 by chatelet.guillaume — 2010-11-30T15:17:14Z
Hi, I'm new to D so this might not be a bug but something I misunderstood about the language. I want to make an associative array of fixed sized array with double as key type. The following code compiles int[2][double] map; map[0] = [1,2]; but fails at runtime with a "Range violation" Surprisingly enough, the following code also compiles ?! int[1][double] map; map[0] = [1,2,3,4,5]; but fails alike at runtime. It looks like the good way to do this is to use int[][double] map; map[0] = [1,2,3,4,5]; But then relaxing the type constraint... Any ideas ? I'm using Digital Mars D Compiler v2.050 on linux x86. Best regards, Guillaume CHATELET
Comment #1 by clugdbug — 2011-01-23T12:52:24Z
This is a duplicate of a very old and serious bug, which will be fixed in the next release. *** This issue has been marked as a duplicate of issue 1899 ***