tsidee4.nim 348 B

123456789101112131415161718
  1. discard """
  2. file: "tsidee4.nim"
  3. line: 12
  4. errormsg: "'noSideEffect' can have side effects"
  5. """
  6. var
  7. global: int
  8. proc dontcare(x: int): int = return global
  9. proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} =
  10. return x + y + dontcare(x)
  11. echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch