Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 69ae3dc

Browse files
authored
Merge pull request dlang#2266 from MartinNowak/merge_stable
Merge remote-tracking branch 'upstream/stable' into merge_stable
2 parents d619e64 + e9671bf commit 69ae3dc

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/core/memory.d

+19-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ void __delete(T)(ref T x) @system
10191019
}
10201020
else static if (is(T : E2[], E2))
10211021
{
1022-
GC.free(x.ptr);
1022+
GC.free(cast(void*) x.ptr);
10231023
x = null;
10241024
}
10251025
}
@@ -1167,3 +1167,21 @@ unittest
11671167
int* pint; __delete(pint);
11681168
S* ps; __delete(ps);
11691169
}
1170+
1171+
// https://issues.dlang.org/show_bug.cgi?id=19092
1172+
unittest
1173+
{
1174+
const(int)[] x = [1, 2, 3];
1175+
assert(GC.addrOf(x.ptr) != null);
1176+
__delete(x);
1177+
assert(x is null);
1178+
assert(GC.addrOf(x.ptr) == null);
1179+
1180+
immutable(int)[] y = [1, 2, 3];
1181+
assert(GC.addrOf(y.ptr) != null);
1182+
__delete(y);
1183+
assert(y is null);
1184+
assert(GC.addrOf(y.ptr) == null);
1185+
}
1186+
1187+

0 commit comments

Comments
 (0)