close #16607 add testcase (#17317)

This commit is contained in:
flywind
2021-03-10 14:16:34 +08:00
committed by GitHub
parent 2f213db7ee
commit 1655103d83

View 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()