trefs.nim 365 B

123456789101112131415161718192021
  1. discard """
  2. errormsg: "type mismatch"
  3. file: "trefs.nim"
  4. line: 20
  5. """
  6. # test for ref types (including refs to procs)
  7. type
  8. TProc = proc (a, b: int): int {.stdcall.}
  9. proc foo(c, d: int): int {.stdcall.} =
  10. return 0
  11. proc wrongfoo(c, e: int): int {.inline.} =
  12. return 0
  13. var p: TProc
  14. p = foo
  15. write(stdout, "success!")
  16. p = wrongfoo #ERROR_MSG type mismatch