twasmoved.nim 180 B

123456789101112131415
  1. type
  2. Foo = object
  3. id: int
  4. proc `=wasMoved`(x: var Foo) =
  5. x.id = -1
  6. proc foo =
  7. var s = Foo(id: 999)
  8. var m = move s
  9. doAssert s.id == -1
  10. doAssert m.id == 999
  11. foo()