summary refs log tree commit diff stats
path: root/tests/vm
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-01-19 04:31:49 +0800
committerGitHub <noreply@github.com>2024-01-18 21:31:49 +0100
commit3fb46fac32b8a1fcf36ac52d09983297251d1213 (patch)
tree04a525e5bf62956bd8b65e335226befa6f296f82 /tests/vm
parent527d1e197731803c4c03b15b6ac0ba2d461eb7f3 (diff)
downloadNim-3fb46fac32b8a1fcf36ac52d09983297251d1213.tar.gz
fixes #12334; keeps `nkHiddenStdConv` for cstring conversions (#23216)
fixes #12334

`nkHiddenStdConv` shouldn't be removed if the sources aren't literals,
viz. constant symbols.
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/tconst.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/vm/tconst.nim b/tests/vm/tconst.nim
index c2bcf78b5..5cfe7533e 100644
--- a/tests/vm/tconst.nim
+++ b/tests/vm/tconst.nim
@@ -42,6 +42,16 @@ template main() =
       discard (x, increment, a)
     mytemp()
 
+  block: # bug #12334
+    block:
+      const b: cstring = "foo"
+      var c = b
+      doAssert c == "foo"
+    block:
+      const a = "foo"
+      const b: cstring = a
+      var c = b
+      doAssert c == "foo"
 
 
 static: main()