t10376.nim 569 B

123456789101112131415161718192021222324252627282930313233
  1. discard """
  2. matrix: "--mm:refc"
  3. errormsg: "finalizer must be a direct reference to a proc"
  4. line: 30
  5. """
  6. type
  7. A = ref object
  8. proc my_callback(a: A) {. nimcall .} =
  9. discard
  10. proc foo(callback: proc(a: A) {. nimcall .}) =
  11. var x1: A
  12. new(x1, proc (x: A) {.nimcall.} = discard)
  13. var x2: A
  14. new(x2, func (x: A) {.nimcall.} = discard)
  15. var x3: A
  16. proc foo1(a: A) {.nimcall.} = discard
  17. new(x3, foo1)
  18. var x4: A
  19. func foo2(a: A) {.nimcall.} = discard
  20. new(x4, foo2)
  21. var x5: A
  22. new(x5, my_callback)
  23. var x6: A
  24. new(x6, callback)
  25. foo(my_callback)