You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid binary and octal literals for 64-bit integers are accepted #5729
When using binary or octal literals for 64-bit integers (both signed and unsigned) the compiler doesn't check for overflows and accepts more than 64 bits.
This also applies to LanguagePrimitives.ParseInt64 and LanguagePrimitives.ParseUInt64.
I noticed that after I ported that portion of the code from the F# compiler to an app of mine.
The compiler should emit FS1149 and FS1150 for signed and unsigned long integers, respectively. The ParseInt64 and ParseUInt64 functions should fail with an OverflowException.
Actual behavior
The compiler accepts more than 64 bits in binary and octal literals. The numbers end up being equal to -1 for int64 and UInt64.MaxValue for uint64.
Known workarounds
Use decimal or hexadecimal literals.
Related information
I can reproduce that on Windows 10 with VS 2017 and on macOS with the .NET Core SDK 2.1.402.
Activity
Fix dotnet#5729 (dotnet#6352)