summary refs log tree commit diff stats
path: root/tests/ccgbugs/twrong_rc_for_refarray.nim
blob: 99bdac5e14769ac5a85b97a5723a487103883f87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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]