mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-17 18:17:11 +00:00
25 lines
371 B
Nim
25 lines
371 B
Nim
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()
|