t10376.nim 547 B

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