Open
Description
Hex literals that would represent a negative number as a 32-bit value have an unexpected value when bound to a 64-bit value.
Repro steps
let a: int64 = 0xffff_ffff
let b: int64 = 0xffff_ffffL
Expected behavior
Not sure. It should either:
- fail to compile like in VS 2019
a
should be equal tob
Actual behavior
a
has a value of -1, as if it was first parsed as a 32-bit signed integer and then converted to a 64-bit integer.
Known workarounds
- add the
L
suffix to the literal - prepend a
0_
to force the value to be parsed as a 64-bit integer (i. e.0x0_ffff_ffff
)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
New