summary refs log tree commit diff stats
path: root/tests/ccgbugs/tmissingderef2.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-11-30 21:10:22 +0100
committerAraq <rumpf_a@web.de>2016-11-30 21:10:22 +0100
commit7b44896e03cde0071bb3d9ab25ca846c4dfc599c (patch)
treefdcaf742a88c09ce9fa7e0739c120a181f6fcde5 /tests/ccgbugs/tmissingderef2.nim
parent20cf28adde8c6e3177f1cc0eca6fe249bc4de438 (diff)
downloadNim-7b44896e03cde0071bb3d9ab25ca846c4dfc599c.tar.gz
fixes #5079
Diffstat (limited to 'tests/ccgbugs/tmissingderef2.nim')
-rw-r--r--tests/ccgbugs/tmissingderef2.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ccgbugs/tmissingderef2.nim b/tests/ccgbugs/tmissingderef2.nim
new file mode 100644
index 000000000..59cd24dd1
--- /dev/null
+++ b/tests/ccgbugs/tmissingderef2.nim
@@ -0,0 +1,25 @@
+discard """
+  output: "c"
+"""
+
+# bug #5079
+
+import tables, strutils
+
+type Test = ref object
+  s: string
+
+proc `test=`(t: Test, s: string) =
+  t.s = s
+
+var t = Test()
+
+#t.test = spaces(2) # -- works
+
+var a = newTable[string, string]()
+a["b"] = "c"
+
+#t.s = a["b"] # -- works
+#t.test a["b"] # -- works
+t.test = a["b"] # -- prints "out of memory" and quits
+echo t.s