mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
fixes #6234
This commit is contained in:
22
tests/ccgbugs/twrongrefcounting.nim
Normal file
22
tests/ccgbugs/twrongrefcounting.nim
Normal file
@@ -0,0 +1,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"
|
||||
Reference in New Issue
Block a user