mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 19:22:40 +00:00
* attach global destructors at end of mainModule * Add testcase * Minor cleanup * Inject topLevelVar temporaries' destructors early * Fix megatest
31 lines
281 B
Nim
31 lines
281 B
Nim
|
|
discard """
|
|
output: '''3
|
|
0
|
|
0
|
|
10
|
|
destroyed!
|
|
'''
|
|
joinable: false
|
|
"""
|
|
|
|
type
|
|
myseq* = object
|
|
f: int
|
|
|
|
proc `=destroy`*(x: var myseq) =
|
|
echo "destroyed!"
|
|
|
|
var
|
|
x: myseq
|
|
x.f = 3
|
|
echo move(x.f)
|
|
echo x.f
|
|
|
|
# bug #9743
|
|
let a = create int
|
|
a[] = 10
|
|
var b = move a[]
|
|
echo a[]
|
|
echo b
|