www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6702] New: .length for Associative Array is not safe

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6702

           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
        AssignedTo: nobody puremagic.com
        ReportedBy: htvennik gmail.com



---
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6702


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 6357 ***

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