summary refs log tree commit diff stats
path: root/tests/ccgbugs/twrongrefcounting.nim
blob: c0c3e0fc24c8de551cb2548a898d52b9419f26d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  output: '''ok'''
  cmd: "nim c -r --gc:refc -d:useGcAssert -d:useSysAssert -d:fulldebug -d:smokeCycles $file"
"""
# bug #6234
type
    Foo = ref object
        s: seq[Bar]
    Bar = ref object
        f: Foo

proc test() =
    var f = Foo.new()
    for i in 0 .. 5:
        f.s = @[]
        for j in 0 .. 5:
            var b = Bar.new()
            b.f = f
            f.s.add(b)

test()
echo "ok"