tselfderef.nim 312 B

123456789101112131415161718192021
  1. discard """
  2. action: compile
  3. """
  4. # bug #4671
  5. {.experimental.}
  6. {.this: self.}
  7. type
  8. SomeObj = object
  9. f: int
  10. proc f(num: int) =
  11. discard
  12. var intptr: ptr int
  13. intptr.f() # compiles fine
  14. proc doSomething(self: var SomeObj) =
  15. var pint: ptr int
  16. pint.f() # Error: expression '.(pint, "f")' cannot be called