[Issue 4327] New: std.container.Array.Range.~this() tries to call free(T[])

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 16 02:18:52 PDT 2010


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

           Summary: std.container.Array.Range.~this() tries to call
                    free(T[])
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-06-16 02:18:19 PDT ---
Example:

  Array!int a;

Error:

std/container.d(1660): Error: function core.stdc.stdlib.free (void* ptr) is not
callable using argument types (int[])
std/container.d(1660): Error: cannot implicitly convert expression
((*this._data)._payload) of type int[] to void*

The fix is trivial, just add .ptr in line 1660:

-            free(_data._payload);
+            free(_data._payload.ptr);

But why aren't the unittests picking this up?  I've investigated a bit, and
found that when Array!int is declared in the std.concurrency unittests, the
int[] is implicitly cast to void* in the call to free().  However, this doesn't
happen when Array!int is declared in user code.  Very strange.

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