Just a small addition from me: 
    
    
    proc withmytype[T](a: T) =
      when (T is ref or T is ptr):
        {.fatal: "Supply only primitive value type".}
      else:
        discard
    
    
    var a = newSeq[int]()
    withmytype(a.addr) # generates an error at compile time
    withmytype(5)
    

This way the error will be always reported already while compiling.

Reply via email to