fixes #13698 [backport:1.2] (#14175)

(cherry picked from commit 89be5be03e)
This commit is contained in:
Andreas Rumpf
2020-04-30 22:45:02 +02:00
committed by narimiran
parent b997e32129
commit 62b9dcb8db
2 changed files with 7 additions and 2 deletions

View File

@@ -45,9 +45,9 @@ proc nimCmpMem*(a, b: pointer, size: Natural): cint {.compilerproc, nonReloadabl
if d != 0: return d
inc i
proc nimCStrLen*(a: cstring): csize_t {.compilerproc, nonReloadable, inline.} =
proc nimCStrLen*(a: cstring): int {.compilerproc, nonReloadable, inline.} =
when useLibC:
c_strlen(a)
cast[int](c_strlen(a))
else:
var a = cast[ptr byte](a)
while a[] != 0:

View File

@@ -41,3 +41,8 @@ except OverflowError, RangeError:
echo x
echo expected == 4
# bug #13698
var
x45 = "hello".cstring
p = x45.len.int32