t16607.nim 365 B

123456789101112131415161718192021222324
  1. discard """
  2. matrix: "--gc:refc; --gc:arc"
  3. """
  4. # bug #16607
  5. type
  6. O {.requiresInit.} = object
  7. initialized: bool
  8. proc `=destroy`(o: var O) =
  9. doAssert o.initialized, "O was destroyed before initialization!"
  10. proc initO(): O =
  11. O(initialized: true)
  12. proc pair(): tuple[a, b: O] =
  13. result = (a: initO(), b: initO())
  14. proc main() =
  15. discard pair()
  16. main()