tovfint.nim 318 B

123456789101112131415161718192021
  1. discard """
  2. output: "works!"
  3. """
  4. # this tests the new overflow literals
  5. var
  6. i: int
  7. i = int(0xffffffff'i32)
  8. when defined(cpu64):
  9. if i == -1:
  10. write(stdout, "works!\n")
  11. else:
  12. write(stdout, "broken!\n")
  13. else:
  14. if i == -1:
  15. write(stdout, "works!\n")
  16. else:
  17. write(stdout, "broken!\n")
  18. #OUT works!