This commit is contained in:
flywind 2021-09-15 01:40:42 +08:00 • committed by GitHub
commit cebf7cdc1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

18
tests/ccgbugs/t10128.nim Normal file
View file

@ -0,0 +1,18 @@
# bug #10128
let data = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
var seq2 = newSeq[char](data.len)
for i in 0..<data.len:
seq2[i] = data[i]
let c = '\128'
# case 1
doAssert data[c.int] == 'y'
doAssert seq2[c.int] == 'y'
proc play(x: openArray[char]) =
doAssert x[c.int] == 'y'
# case2
play(data)
play(seq2)