[Issue 20332] New: associative array clear function should be @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 28 21:11:52 UTC 2019


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 at puremagic.com
          Reporter: schveiguy at 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).

--


More information about the Digitalmars-d-bugs mailing list