summary refs log tree commit diff stats
path: root/tests/arc/t18971.nim
diff options
context:
space:
mode:
authorDerek 呆 <116649+derekdai@users.noreply.github.com>2021-10-30 01:55:48 +0800
committerGitHub <noreply@github.com>2021-10-29 19:55:48 +0200
commitf755e452d2a2c7656f07793b7f01dc654a7c5253 (patch)
tree40c33b29583885a48ba2aaef2c8f9090e8dc18cb /tests/arc/t18971.nim
parentcfdac6666f5772479724e082fb08c2db694d8d40 (diff)
downloadNim-f755e452d2a2c7656f07793b7f01dc654a7c5253.tar.gz
fix #18971 (#19070) [backport:1.6]
since the example code return value from global variable, instead
of first argument, the `n.len` is 1 which causes compiler crashes.
Diffstat (limited to 'tests/arc/t18971.nim')
-rw-r--r--tests/arc/t18971.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/arc/t18971.nim b/tests/arc/t18971.nim
new file mode 100644
index 000000000..9b587d956
--- /dev/null
+++ b/tests/arc/t18971.nim
@@ -0,0 +1,10 @@
+discard """
+  cmd: "nim c --gc:arc $file"
+"""
+
+type MyObj = ref object
+
+var o = MyObj()
+proc x: var MyObj = o
+
+var o2 = x()