tinvalidinout.nim 608 B

123456789101112131415161718192021222324252627
  1. discard """
  2. cmd: "nim check $file"
  3. errormsg: "the 'in' modifier can be used only with imported types"
  4. nimout: '''
  5. tinvalidinout.nim(14, 7) Error: the 'out' modifier can be used only with imported types
  6. tinvalidinout.nim(17, 9) Error: the 'in' modifier can be used only with imported types
  7. tinvalidinout.nim(18, 9) Error: the 'in' modifier can be used only with imported types
  8. '''
  9. """
  10. type
  11. Foo[in T] {.header: "foo.h", importcpp.} = object
  12. Bar[out X] = object
  13. x: int
  14. proc f1[in T](x: T) = discard
  15. proc f2[in T](x: T) {.importc: "f", header: "foo.h"}
  16. var
  17. f: Foo[int]
  18. b: Bar[string]
  19. f1 f
  20. f2 b