tstrict_effects2.nim 483 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. errormsg: "can raise an unlisted exception: Exception"
  3. line: 23
  4. """
  5. {.push warningAsError[Effect]: on.}
  6. {.experimental: "strictEffects".}
  7. # bug #13905
  8. proc atoi(v: cstring): cint {.importc: "atoi", cdecl, raises: [].}
  9. type Conv = proc(v: cstring): cint {.cdecl, raises: [].}
  10. var x: Conv = atoi
  11. # bug #17475
  12. type
  13. Callback = proc()
  14. proc f(callback: Callback) {.raises: [].} =
  15. callback()
  16. proc main =
  17. f(proc () = raise newException(IOError, "IO"))
  18. main()