Bug 21236 – Associative array opApply is not nothrow

Status
NEW
Severity
critical
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-11T01:55:00Z
Last change time
2024-12-07T13:40:40Z
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#17412 →

Comments

Comment #0 by andrej.mitrovich — 2020-09-11T01:55:00Z
----- void main () nothrow { int[int] map; foreach (pair; map.byKeyValue) // OK { } foreach (key, val; map) // Error: `_aaApply2` is not `nothrow` { } } ----- I couldn't find a related issue for AA's that was still open.
Comment #1 by lio+bugzilla — 2020-11-13T06:23:34Z
This is problematic when trying to implement `toHash` for a type that has a nested AA. Without `nothrow` on `toHash` you get: source/value.d(481,13): Error: _aaApply2 is not nothrow With `nothrow` you get: source/value.d(461,12): Warning: toHash() must be declared as extern (D) size_t toHash() const nothrow @safe, not const pure @trusted ulong()
Comment #2 by bugzilla — 2022-02-27T06:13:47Z
What happens when you declare toHash() as extern (D) size_t toHash() const nothrow @safe ?
Comment #3 by robert.schadek — 2024-12-07T13:40:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17412 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB