t22284.nim 641 B

12345678910111213141516171819202122232425
  1. discard """
  2. errormsg: "j(uRef, proc (config: F; sources: auto) {.raises: [].} = discard ) can raise an unlisted exception: Exception"
  3. """
  4. import std/macros
  5. macro h(): untyped =
  6. result = newTree(nnkStmtList)
  7. result.add quote do:
  8. new int
  9. type F = object
  10. proc j[SecondarySources](
  11. uRef: ref SecondarySources,
  12. u: proc (config: F, sources: ref SecondarySources)): F =
  13. u(result, uRef)
  14. template programMain(body: untyped) =
  15. proc main {.raises: [].} = body # doesn't SIGSEGV without this {.raises: [].}
  16. main()
  17. programMain:
  18. var uRef = h()
  19. discard j(uRef, u = proc(config: F, sources: auto) {.raises: [].} = discard)