It seems that if you import a C type as object, and cast a variable of that type into another, will get some strange result.
type X {.importc: "int".} = object
{.emit: "int a = 10;".}
var a {.importc, nodecl.}: X
assert cast[ptr int](addr a)[] == 10 #suceeded
assert cast[int](a) == 10 #failed
# This does not happen if you change `object` into `cint`
Is it a bug? This should work, though (as @amadan pointed out, int in Nim is not of the same size as int in C):
assert cast[cint](a) == 10