You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unpacking a sequence of ref object in unpack_items_imp writes to same address.
The following code should echo 2 3 5 but echos 5 5 5:
import msgpack4nim, streams
import msgpack4nim / msgpack4collection
import lists
typeElement=refobject
value: intprocnewElement(value: int): Element=result=newElementresult.value = value
var elementList =initDoublyLinkedList[Element]()
elementList.add(newElement(2))
elementList.add(newElement(3))
elementList.add(newElement(5))
var strm =MsgStream.init()
strm.pack(elementList)
var sstrm =MsgStream.init(strm.data)
var unpackedList: DoublyLinkedList[Element]
sstrm.unpack(unpackedList)
for e in unpackedList:
echo e.value
Moving var x: T into the for loop in the unpack_items_imp template fixed the problem for me.
The text was updated successfully, but these errors were encountered:
Unpacking a sequence of
ref object
inunpack_items_imp
writes to same address.The following code should echo 2 3 5 but echos 5 5 5:
Moving
var x: T
into the for loop in theunpack_items_imp
template fixed the problem for me.The text was updated successfully, but these errors were encountered: