summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorGiuliano Mega <giuliano.mega@gmail.com>2024-01-18 10:40:22 -0300
committerGitHub <noreply@github.com>2024-01-18 14:40:22 +0100
commit473f259268d03f87874c674c08c74cf32da11d4a (patch)
tree1afa71d34414324ca5bc7133d3d142271f24888b /tests/ccgbugs
parent2425f4559cc5e8a96cf0dccea72817a782918de0 (diff)
downloadNim-473f259268d03f87874c674c08c74cf32da11d4a.tar.gz
Fix reset code gen for range types (#22462, #23214) (#23215)
This PR modifies `specializeResetT` so that it generates the proper
reset code for range types. I've tested it in the examples for issues
#23214 and #22462 as well as our codebase, and it seems to fix the
issues I had been experiencing.
Diffstat (limited to 'tests/ccgbugs')
-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