You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type
C =object
heaped: refarray[1, uint8]
proc`=copy`(dst: var C, src: C) =if dst.heaped != src.heaped:
new(dst.heaped)
dst.heaped[] = src.heaped[]
procnewC(): C =C(heaped: new(array[1, uint8]))
var c =newC()
zerbina
changed the title
VM backend crash when =copy is defined for an object with ref fieldnim e crashes when user-defined hooks are used
Aug 7, 2024
I've tried building and running the provided example with the VM backend, and it works as it should.
Going by the actual output you showed, you using NimScript rather than the VM backend, which are two different things. In NimScript, hooks don't work at all, unrelated to ref fields. Here's a reduced reproducer:
type
C =objectproc`=destroy`(dst: var C) =discardblock:
var c =newC()
running the above results in the same crash.
I've changed the title of the issue, in order to make it clearer what's going on.
Example
Actual Output
Additional Information
The text was updated successfully, but these errors were encountered: