mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
fix #18627(Program segfaults with ARC when using openArray[string]) (#18713)
* fix #18627 * add testcase * rename * another * remove tyVarargs
This commit is contained in:
@@ -1595,7 +1595,7 @@ proc propagateToOwner*(owner, elem: PType; propagateHasAsgn = true) =
|
||||
if mask != {} and propagateHasAsgn:
|
||||
let o2 = owner.skipTypes({tyGenericInst, tyAlias, tySink})
|
||||
if o2.kind in {tyTuple, tyObject, tyArray,
|
||||
tySequence, tySet, tyDistinct, tyOpenArray, tyVarargs}:
|
||||
tySequence, tySet, tyDistinct}:
|
||||
o2.flags.incl mask
|
||||
owner.flags.incl mask
|
||||
|
||||
|
||||
24
tests/arc/topenarray.nim
Normal file
24
tests/arc/topenarray.nim
Normal file
@@ -0,0 +1,24 @@
|
||||
discard """
|
||||
input: "hi"
|
||||
output: '''
|
||||
hi
|
||||
Nim
|
||||
'''
|
||||
matrix: "--gc:arc -d:useMalloc; --gc:arc"
|
||||
"""
|
||||
block: # bug 18627
|
||||
proc setPosition(params: openArray[string]) =
|
||||
for i in params.toOpenArray(0, params.len - 1):
|
||||
echo i
|
||||
|
||||
proc uciLoop() =
|
||||
let params = @[readLine(stdin)]
|
||||
setPosition(params)
|
||||
|
||||
uciLoop()
|
||||
|
||||
proc uciLoop2() =
|
||||
let params = @["Nim"]
|
||||
for i in params.toOpenArray(0, params.len - 1):
|
||||
echo i
|
||||
uciLoop2()
|
||||
Reference in New Issue
Block a user