t9334.nim 304 B

1234567891011121314151617181920
  1. discard """
  2. cmd: "nim $target --hints:off $options -r $file"
  3. nimout: '''@[1]
  4. @[1, 1]
  5. '''
  6. nimoutFull: true
  7. """
  8. proc p(s: var seq[int]): auto =
  9. let sptr = addr s
  10. return proc() = sptr[].add 1
  11. proc f =
  12. var data = @[1]
  13. p(data)()
  14. echo repr data
  15. static:
  16. f() # prints [1]
  17. f() # prints [1, 1]