summary refs log tree commit diff stats
path: root/tests/ccgbugs/t22462.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/t22462.nim')
-rw-r--r--tests/ccgbugs/t22462.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ccgbugs/t22462.nim b/tests/ccgbugs/t22462.nim
new file mode 100644
index 000000000..9adfbb19b
--- /dev/null
+++ b/tests/ccgbugs/t22462.nim
@@ -0,0 +1,20 @@
+discard """
+  action: "run"
+  output: '''
+1
+1
+1
+'''
+  matrix: "--mm:refc"
+  targets: "c cpp"
+"""
+
+type Object = object
+  someComplexType: seq[int]
+  index: Natural
+
+func newObject(): Object = result.index.inc
+
+for i in 1..3:
+  let o = newObject()
+  echo o.index