Bug 4327 – std.container.Array.Range.~this() tries to call free(T[])
Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-06-16T02:18:00Z
Last change time
2010-08-11T02:46:29Z
Assigned to
bugzilla
Creator
bugzilla
Comments
Comment #0 by bugzilla — 2010-06-16T02:18:19Z
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.