Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2266 from MartinNowak/merge_stable
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'upstream/stable' into merge_stable
  • Loading branch information
wilzbach authored Aug 7, 2018
2 parents d619e64 + e9671bf commit 69ae3dc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/core/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ void __delete(T)(ref T x) @system
}
else static if (is(T : E2[], E2))
{
GC.free(x.ptr);
GC.free(cast(void*) x.ptr);
x = null;
}
}
Expand Down Expand Up @@ -1167,3 +1167,21 @@ unittest
int* pint; __delete(pint);
S* ps; __delete(ps);
}

// https://issues.dlang.org/show_bug.cgi?id=19092
unittest
{
const(int)[] x = [1, 2, 3];
assert(GC.addrOf(x.ptr) != null);
__delete(x);
assert(x is null);
assert(GC.addrOf(x.ptr) == null);

immutable(int)[] y = [1, 2, 3];
assert(GC.addrOf(y.ptr) != null);
__delete(y);
assert(y is null);
assert(GC.addrOf(y.ptr) == null);
}


0 comments on commit 69ae3dc

Please sign in to comment.