This is an issue with generics in templates, it's not a problem in procs 
however.
    
    
    proc addTo[T](point: ptr T, val: T) =
      point[] = point[] + val
    
    var a = 3'u16
    addTo[uint16](addr(a), 3)
    doAssert(a == 6)
    

Because parameters with types in templates actually check for expressions with 
the type, I'd assume the template expected the type of the expression `0xFFFF` 
to be equal to uint16, but it was forced into being int. I guess this could be 
filed as an [issue](https://github.com/nim-lang/Nim/issues)

Reply via email to