summary refs log tree commit diff stats
path: root/tests/system/trefs.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/trefs.nim')
-rw-r--r--tests/system/trefs.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/system/trefs.nim b/tests/system/trefs.nim
new file mode 100644
index 000000000..8c36aec52
--- /dev/null
+++ b/tests/system/trefs.nim
@@ -0,0 +1,15 @@
+discard """
+  targets: "c js"
+"""
+
+# bug #21317
+proc parseHook*(v: var ref int) =
+  var a: ref int
+  new(a)
+  a[] = 123
+  v = a
+
+proc fromJson2*(): ref int =
+  parseHook(result)
+
+doAssert fromJson2()[] == 123