Same example but with all cases added.
I noticed while working on this example that the issue would disappear and
surface again simple by changing the object and function names (no semantic
difference). But this version is tested and shows the issue
type
Status = enum
Ok, Error
Ret8 = object
status:Status
data:uint8
Ret32 = object
status:Status
data:uint32
proc test8():Ret8 =
return Ret8(status:Ok,data:0)
proc test32():Ret32 =
return Ret32(status:Ok,data:0)
let local = Ret8(status:Ok,data:0)
echo "local ", repr(local) # Ok
let a = test8()
echo "a ", a # OK
echo "a ", repr(a) # Error
let b = test32()
echo "b ", b # OK
echo "b ", repr(b) # OK