--gc:destructors: hello world example compiles and runs

This commit is contained in:
Araq
2018-11-16 00:13:39 +01:00
parent 2eb14bdd41
commit 4bd9f32f33
4 changed files with 13 additions and 3 deletions

View File

@@ -125,7 +125,7 @@ proc grow*[T](x: var seq[T]; newLen: Natural; value: T) =
if newLen <= oldLen: return
var xu = cast[ptr NimSeqV2[T]](addr x)
xu.p = prepareSeqAdd(oldLen, xu.p, newLen - oldLen, sizeof(T))
xu.p = cast[typeof(xu.p)](prepareSeqAdd(oldLen, xu.p, newLen - oldLen, sizeof(T)))
xu.len = newLen
for i in oldLen .. newLen-1:
x.data[i] = value