-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
In template fooT[T](x: A[T]) calling foo(T), which is a proc, crashes the compiler and calling fooT(T), which is a template, matches the int overload instead of typedesc[int].
type
A[T] = object
v: T
proc foo(x: int) = echo "int"
proc foo(x: typedesc[int]) = echo "typedesc[int]"
template fooT(x: int) = echo "int"
template fooT(x: typedesc[int]) = echo "typedesc[int]"
proc foo[T](x: A[T]) =
foo(T) # typedesc[int] (correct)
fooT(T) # typedesc[int] (correct)
template fooT[T](x: A[T]) =
foo(T) # typedescparam.nim(20, 5) Error: internal error: expr(skType); unknown symbol
fooT(T) # int (should be typedesc[int])
var x: A[int]
foo(x)
fooT(x)