summary refs log tree commit diff stats
path: root/tests/vm/tmitems.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vm/tmitems.nim')
-rw-r--r--tests/vm/tmitems.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/vm/tmitems.nim b/tests/vm/tmitems.nim
index a77c3fb23..a0e64d6aa 100644
--- a/tests/vm/tmitems.nim
+++ b/tests/vm/tmitems.nim
@@ -29,3 +29,17 @@ macro m: typed =
     result.add newCall(bindsym"echo", i)
 
 m()
+
+# bug 4741 & 5013
+proc test() =
+  var s = [("baz", 42), ("bath", 42)]
+  for i in s.mitems:
+    i[1] = 3
+  doAssert(s == [("baz", 3), ("bath", 3)])
+
+static:
+  test()
+  var s = [("baz", 42), ("bath", 42)]
+  for i in s.mitems:
+    i[1] = 3
+  doAssert(s == [("baz", 3), ("bath", 3)])