t5342.nim 250 B

1234567891011121314151617181920212223
  1. discard """
  2. matrix: "--gc:refc; --gc:arc"
  3. output: '''
  4. 1
  5. 2
  6. here
  7. 2
  8. 1
  9. '''
  10. """
  11. type
  12. A = object
  13. id: int
  14. B = object
  15. a: A
  16. proc `=destroy`(a: var A) = echo a.id
  17. var x = A(id: 1)
  18. var y = B(a: A(id: 2))
  19. `=destroy`(x)
  20. `=destroy`(y)
  21. echo "here"