fixes #4653
This commit is contained in:
parent
636e74fe39
commit
18e37cad08
2 changed files with 28 additions and 0 deletions
26
tests/ccgbugs/twrong_rc_for_refarray.nim
Normal file
26
tests/ccgbugs/twrong_rc_for_refarray.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
discard """
|
||||
output: '''m[0][0] = 1.0
|
||||
m[0][0] = 2.0'''
|
||||
"""
|
||||
# bug #4653
|
||||
type
|
||||
Vector = ref array[2, float64]
|
||||
Matrix = ref array[2, Vector]
|
||||
|
||||
proc newVector(): Vector =
|
||||
new(result)
|
||||
|
||||
proc newMatrix(): Matrix =
|
||||
new(result)
|
||||
for ix in 0 .. 1:
|
||||
result[ix] = newVector()
|
||||
|
||||
let m = newMatrix()
|
||||
|
||||
m[0][0] = 1.0
|
||||
echo "m[0][0] = ", m[0][0]
|
||||
|
||||
GC_fullCollect()
|
||||
|
||||
m[0][0] = 2.0
|
||||
echo "m[0][0] = ", m[0][0]
|
||||
Loading…
Add table
Add a link
Reference in a new issue