nrvo shouldn't touch bycopy object[backport:1.2] (#19385)

fix nim-lang#19342
This commit is contained in:
flywind 2022-01-14 00:39:17 +08:00 • committed by GitHub
commit 9b9ae8a487
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

18
tests/objects/t19342.nim Normal file
View file

@ -0,0 +1,18 @@
discard """
targets: "c cpp"
"""
{.compile: "m19342.c".}
# bug #19342
type
Node* {.bycopy.} = object
data: array[25, cint]
proc myproc(name: cint): Node {.importc: "hello", cdecl.}
proc parse =
let node = myproc(10)
doAssert node.data[0] == 999
parse()