[Issue 6702] New: .length for Associative Array is not @safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 20 11:24:36 PDT 2011
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 at puremagic.com
ReportedBy: htvennik at gmail.com
--- Comment #0 from Harry Vennik <htvennik at gmail.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list