www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20332] New: associative array clear function should be safe

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

          Issue ID: 20332
           Summary: associative array clear function should be  safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

If you look at the implementation of clear, it does not invalidate any items in
the array. It just sets to null all the pointers to bucket items. The items
themselves remain allocated, and any range that is pointing at a null bucket
item will return null for the key or value, causing a null dereference (which
is considered  safe).

--
Oct 28 2019