mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
fixes #24319 `byRefLoc` (`mapType`) requires the Loc `a` to have the right type. Without `lfEnforceDeref`, it produces the wrong type for `deref (var array)`, which may come from `mitems`.
This commit is contained in:
@@ -2321,7 +2321,7 @@ proc genWasMoved(p: BProc; n: PNode) =
|
||||
# [addrLoc(p.config, a), getTypeDesc(p.module, a.t)])
|
||||
|
||||
proc genMove(p: BProc; n: PNode; d: var TLoc) =
|
||||
var a: TLoc = initLocExpr(p, n[1].skipAddr)
|
||||
var a: TLoc = initLocExpr(p, n[1].skipAddr, {lfEnforceDeref})
|
||||
if n.len == 4:
|
||||
# generated by liftdestructors:
|
||||
var src: TLoc = initLocExpr(p, n[2])
|
||||
|
||||
@@ -16,3 +16,16 @@ block:
|
||||
doAssert s == 2
|
||||
|
||||
foo()
|
||||
|
||||
import std/deques
|
||||
|
||||
block: # bug #24319
|
||||
var queue = initDeque[array[32, byte]]()
|
||||
for i in 0 ..< 5:
|
||||
let element: array[32, byte] = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1,
|
||||
]
|
||||
queue.addLast(element)
|
||||
|
||||
doAssert queue.popLast[^1] == byte(1)
|
||||
|
||||
Reference in New Issue
Block a user