-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Version Used: lab.razor.fyi, sharplab.io, godbolt.org
Steps to Reproduce:
using System;
switch ((object)(nint)2)
{
case 2:
break;
case (nint)2:
Console.WriteLine("Case 2");
goto case (nint)2;
}Expected Behavior:
Loops printing "Case 2" forever.
Actual Behavior:
Prints "Case 2" only once.
Note: the following code blocks do not exhibit the bug:
using System;
switch ((object)(nuint)2)
{
case 2:
break;
case (nuint)2:
Console.WriteLine("Case 2");
goto case (nuint)2;
}using System;
switch ((object)(long)2)
{
case 2:
break;
case (long)2:
Console.WriteLine("Case 2");
goto case (long)2;
}using System;
switch ((object)(int)2)
{
case (short)2:
break;
case 2:
Console.WriteLine("Case 2");
goto case (int)2;
}using System;
switch ((object)2L)
{
case (nint)2:
break;
case 2L:
Console.WriteLine("Case 2");
goto case 2L;
}using System;
switch ((object)(nint)2)
{
case (nint)2:
Console.WriteLine("Case 2");
goto case (nint)2;
}This case also exhibits it:
using System;
switch ((object)(nuint)2)
{
case (uint)2u:
break;
case (nuint)2:
Console.WriteLine("Case 2");
goto case (nuint)2;
}