tfoldedaddr.nim 458 B

123456789101112131415161718192021222324252627282930313233
  1. discard """
  2. output: '''
  3. 23
  4. 23
  5. 23
  6. 23
  7. 23
  8. 23
  9. '''
  10. """
  11. block: # issue #24305
  12. iterator demo(a: openArray[int]): int =
  13. for k in countUp(a[0], 19):
  14. yield 23
  15. for k in demo(@[17]):
  16. echo k
  17. block: # issue #24305 with array
  18. iterator demo(a: array[1, int]): int =
  19. for k in countUp(a[0], 19):
  20. yield 23
  21. for k in demo([17]):
  22. echo k
  23. block: # related regression
  24. proc main =
  25. let a = [0, 1, 2]
  26. let x = addr a[low(a)]
  27. main()