Fixed codegen for constant cstring with --gc:arc (#13326)

* Fixed codegen for constant cstring with --gc:arc, fixes  #13321

* Added test for #13321
This commit is contained in:
Ico Doornekamp
2020-02-04 17:39:27 +01:00
committed by GitHub
parent 7cc03b43f8
commit bfe96e069b
2 changed files with 17 additions and 1 deletions

16
tests/arc/tcstring.nim Normal file
View File

@@ -0,0 +1,16 @@
discard """
cmd: "nim c --gc:arc -r $file"
nimout: '''hello
h
o
'''
"""
# Issue #13321: [codegen] --gc:arc does not properly emit cstring, results in SIGSEGV
let a = "hello".cstring
echo a
echo a[0]
echo a[4]
doAssert a[a.len] == '\0'