mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +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`.
32 lines
571 B
Nim
32 lines
571 B
Nim
discard """
|
|
targets: "c cpp"
|
|
"""
|
|
|
|
block:
|
|
var called = 0
|
|
|
|
proc bar(a: var int): var int =
|
|
inc called
|
|
result = a
|
|
|
|
proc foo =
|
|
var a = 2
|
|
var s = move bar(a)
|
|
doAssert called == 1
|
|
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)
|