taddhigh.nim 216 B

1234567891011121314151617181920
  1. discard """
  2. output: '''@[5, 5, 5, 5, 5]'''
  3. """
  4. # bug #1832
  5. var s = @[5]
  6. # Works fine:
  7. let x = s[s.high]
  8. s.add x
  9. # Causes the 0 to appear:
  10. s.add s[s.high]
  11. s.add s[s.len-1]
  12. s.add s[s.len-1]
  13. echo s # @[5, 5, 0]