This reverts commit 3ce27511ad.
This commit is contained in:
parent
e922d73dd6
commit
4545995e2d
1 changed files with 24 additions and 0 deletions
24
tests/destructor/t16607.nim
Normal file
24
tests/destructor/t16607.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--gc:refc; --gc:arc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #16607
|
||||||
|
|
||||||
|
type
|
||||||
|
O {.requiresInit.} = object
|
||||||
|
initialized: bool
|
||||||
|
|
||||||
|
proc `=destroy`(o: var O) =
|
||||||
|
doAssert o.initialized, "O was destroyed before initialization!"
|
||||||
|
|
||||||
|
proc initO(): O =
|
||||||
|
O(initialized: true)
|
||||||
|
|
||||||
|
proc pair(): tuple[a, b: O] =
|
||||||
|
result.a = initO()
|
||||||
|
result.b = initO()
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
discard pair()
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue