t6434.nim 389 B

1234567891011121314151617181920212223242526
  1. discard """
  2. exitcode: 0
  3. output: ""
  4. """
  5. type
  6. Foo* = object
  7. boo: int
  8. var sink_counter = 0
  9. var assign_counter = 0
  10. proc `=sink`(dest: var Foo, src: Foo) =
  11. sink_counter.inc
  12. proc `=`(dest: var Foo, src: Foo) =
  13. assign_counter.inc
  14. proc test(): auto =
  15. var a,b : Foo
  16. return (a, b, Foo(boo: 5))
  17. var (a, b, _) = test()
  18. doAssert: assign_counter == 0
  19. doAssert: sink_counter == 9