Summary: .length for Associative Array is not @safe
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Harry Vennik <> 2011-09-20 11:24:09 PDT 
The 'length' property of an associative array should be usable from @safe code,
but isn't.

The following code doesn't compile:

module assoc;

import std.stdio;

string[int] a = [1: "foo", 2: "bar"];

@safe void main()
    writefln("%d items.", a.length);

The compiler output is:

assoc.d(9): Error: safe function 'main' cannot call system function 'length'

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to