summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-12-18 22:31:13 +0800
committerGitHub <noreply@github.com>2022-12-18 22:31:13 +0800
commit53eed2be4515a3ae853ae4d2fbd84daa49c1d6d6 (patch)
treeec68f7b5542355e317f60dac4b9ec48789744bc3
parent100b304ac2aaa65222d7a9043acd0c534ed484cb (diff)
downloadNim-53eed2be4515a3ae853ae4d2fbd84daa49c1d6d6.tar.gz
close #11705; add a testcase (#21128)
-rw-r--r--tests/template/t11705.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/template/t11705.nim b/tests/template/t11705.nim
new file mode 100644
index 000000000..65ddc7e6c
--- /dev/null
+++ b/tests/template/t11705.nim
@@ -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()