tpush.nim 399 B

12345678910111213141516171819202122232425262728
  1. # test the new pragmas
  2. {.push warnings: off, hints: off.}
  3. proc noWarning() =
  4. var
  5. x: int
  6. echo(x)
  7. {.pop.}
  8. proc WarnMe() =
  9. var
  10. x: int
  11. echo(x)
  12. # bug #11852
  13. proc foo(x: string, y: int, res: int) =
  14. {.push checks: off}
  15. var a: ptr char = unsafeAddr(x[y])
  16. {.pop.}
  17. if x.len > y:
  18. doAssert ord(a[]) == 51
  19. else:
  20. doAssert x.len + 48 == res
  21. foo("", 0, 48)
  22. foo("abc", 40, 51)