The value of y depends on whether the program is executed on 32-bit or 64-bit platform. Therefore the value should be treated as non-constant. See LDM-2020-03-25.
using System;
class Program
{
static void Main()
{
const long x = 0xFFFFFFFFFFFFFFFL;
const nint y = unchecked((nint)x);
nint z = unchecked((nint)x);
Console.WriteLine("{0}, {1}", y, z);
}
}
Expected: error CS0133: The expression being assigned to 'y' must be constant
Actual: No errors