t11705.nim 357 B

123456789101112131415161718
  1. type RefObj = ref object
  2. proc `[]`(val: static[int]) = # works with different name/overload or without static arg
  3. discard
  4. template noRef*(T: typedesc): typedesc = # works without template indirection
  5. typeof(default(T)[])
  6. proc `=destroy`(x: var noRef(RefObj)) =
  7. discard
  8. proc foo =
  9. var x = new RefObj
  10. doAssert $(x[]) == "()"
  11. # bug #11705
  12. foo()