[Issue 5292] New: Associative array with fixed sized array as value issues a Range violation when inserting new value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 30 15:18:50 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5292

           Summary: Associative array with fixed sized array as value
                    issues a Range violation when inserting new value
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: druntime
        AssignedTo: sean at invisibleduck.org
        ReportedBy: chatelet.guillaume at gmail.com


--- Comment #0 from Guillaume Chatelet <chatelet.guillaume at gmail.com> 2010-11-30 15:17:14 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list