[Issue 5555] Built-in associative arrays in pure nothrow functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 18 11:40:00 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5555
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|built-in associative |Built-in associative arrays
|array's length is not |in pure nothrow functions
|nothrow |
--- Comment #2 from bearophile_hugs at eml.cc 2011-09-18 11:39:35 PDT ---
Currently associative arrays can't be used much in pure nothrow functions:
void main() pure nothrow {
int[int] aa;
aa.rehash;
auto L = aa.length;
auto x = aa.get(0, 10);
auto k = aa.keys;
auto v = aa.values;
auto bk = aa.byKey();
auto bv = aa.byValue();
}
DMD 2.055 gives:
test.d(3): Error: pure function 'main' cannot call impure function 'rehash'
test.d(4): Error: pure function 'main' cannot call impure function 'length'
test.d(5): Error: pure function 'main' cannot call impure function 'get'
test.d(6): Error: pure function 'main' cannot call impure function 'keys'
test.d(7): Error: pure function 'main' cannot call impure function 'values'
test.d(8): Error: pure function 'main' cannot call impure function 'byKey'
test.d(9): Error: pure function 'main' cannot call impure function 'byValue'
test.d(3): Error: aa.rehash is not nothrow
test.d(4): Error: aa.length is not nothrow
test.d(5): Error: aa.get is not nothrow
test.d(6): Error: aa.keys is not nothrow
test.d(7): Error: aa.values is not nothrow
test.d(8): Error: aa.byKey is not nothrow
test.d(9): Error: aa.byValue is not nothrow
test.d(1): Error: function D main 'main' is nothrow yet may throw
--
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