close #11705; add a testcase (#21128)

(cherry picked from commit 53eed2be45)
This commit is contained in:
ringabout
2022-12-18 22:31:13 +08:00
committed by narimiran
parent f0324e99da
commit eaac22b9aa

17
tests/template/t11705.nim Normal file
View File

@@ -0,0 +1,17 @@
type RefObj = ref object
proc `[]`(val: static[int]) = # works with different name/overload or without static arg
discard
template noRef*(T: typedesc): typedesc = # works without template indirection
typeof(default(T)[])
proc `=destroy`(x: var noRef(RefObj)) =
discard
proc foo =
var x = new RefObj
doAssert $(x[]) == "()"
# bug #11705
foo()