diff options
author | Araq <rumpf_a@web.de> | 2012-08-22 23:55:46 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-08-22 23:55:46 +0200 |
commit | c4c0c41d616f1859aa588f50a422aed608df6b77 (patch) | |
tree | 7b56675bc4398ef46f226e60777d07c88d9a9ee1 | |
parent | 1c6870712ba368ef9112f8791b3e4123b6cffbcc (diff) | |
download | Nim-c4c0c41d616f1859aa588f50a422aed608df6b77.tar.gz |
fixes #185
-rwxr-xr-x | lib/system/assign.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/system/assign.nim b/lib/system/assign.nim index f29dc547c..a6c274250 100755 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -71,8 +71,13 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) = var dstseq = cast[PGenericSeq](dst) dstseq.len = seq.len dstseq.reserved = seq.len - of tyObject, tyTuple: - # we don't need to copy m_type field for tyObject, as they are equal anyway + of tyObject: + # we need to copy m_type field for tyObject, as it could be empty for + # sequence reallocations: + var pint = cast[ptr PNimType](dest) + pint[] = cast[ptr PNimType](src)[] + genericAssignAux(dest, src, mt.node, shallow) + of tyTuple: genericAssignAux(dest, src, mt.node, shallow) of tyArray, tyArrayConstr: for i in 0..(mt.size div mt.base.size)-1: |