# Replace:
    proc atomicIncRelaxed*[T: AtomType](p: VolatilePtr[T], x: T = 1): T
    # with:
    proc atomicIncRelaxed*[T: AtomType](p: VolatilePtr[T], x: T = 1.int32): T
    

Note it will still work for int64 thanks to the conversion.

The reason of this problem is that int32 is int at the same time. Because you 
used 1, which is int, and the VolatilePtr[int32] could be VolatilePtr[int] as 
well (thanks to int=int32), I take it the compiler was happy to assume T=int. 
When you use 1.int32 explicitly, either in the call or default value, it does 
the opposite: if it takes VolatilePtr[int], it assumes it is VolatilePtr[int32] 
(because it matched the default 1.int32) and happily assigns an int32 result to 
an int.

So the general conclusion is: type equality is one-way in some contexts.

Reply via email to