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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Harry Vennik <[email protected]> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------