mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
18 lines
357 B
Nim
18 lines
357 B
Nim
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()
|