[Issue 4179] [AA] Deleting items from an associative array iterated over

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 17 12:54:36 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=4179

--- Comment #13 from Ivan Kazmenko <gassa at mail.ru> ---
(In reply to Andrei Alexandrescu from comment #12)
> We've just had this issue at work, looks like undefined behavior. An
> associative array with keys deleted during iteration caused crashes without
> stack trace and without core dump.
> 
> The right thing here is to throw an exception if an AA is removed from
> during an iteration.

Not just removal. Even *adding* (not deleting) elements to associative array
can cause reallocation and undefined behavior as well:

https://issues.dlang.org/show_bug.cgi?id=12218

--


More information about the Digitalmars-d-bugs mailing list