www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bugzilla kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzilla 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: -------
Jun 16 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4327


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody puremagic.com        |bugzilla kyllingen.net


--- Comment #1 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-06-16
02:37:33 PDT ---
http://www.dsource.org/projects/phobos/changeset/1651

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4327


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 16 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4327


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-08-11
02:46:29 PDT ---
Fixed DMD 2.048

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2010