[Issue 5683] New: Calling .clear on a fresh associative array causes subsequent segfault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 2 14:54:57 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5683

           Summary: Calling .clear on a fresh associative array causes
                    subsequent segfault
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Marco.Leise at gmx.de


--- Comment #0 from Marco Leise <Marco.Leise at gmx.de> 2011-03-02 14:52:05 PST ---
In DMD 2.051 and 2.052 the following code doesn't run:

void main() {
  int[char] test;
  test.clear;     // <- this provokes the bug
  test['x'] = 42;
}

This happens independently of the key type (int, char, struct). It seems like
associative arrays are not in the 'clear' state when they are created.
A typical use case is a field of a class that gets filled with values by a
method that needs to clear out old content if any. I considered this a major
bug, because it happens with a core feature.

-- 
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