Closed
Description
public class Program
{
static void Main()
{
_ = (Get1() && Get2());
}
static S1 Get1() => new S1();
static S1 Get2() => new S1();
}
struct S1
{
public static S1 operator &(S1 x, S1 y) => x;
public static bool operator true(S1? x) => true;
public static bool operator false(S1? x) => false;
}
PEVerify fails: [ : Program::Main][mdToken=0x6000003][offset 0x00000008][found value 'S1'][expected value 'System.Nullable`1[S1]'] Unexpected type on the stack.
IL:
.method private hidebysig static
void Main () cil managed
{
// Method begins at RVA 0x2050
// Code size 30 (0x1e)
.maxstack 2
.locals init (
[0] valuetype S1
)
IL_0000: nop
IL_0001: call valuetype S1 Program::Get1()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: call bool S1::op_False(valuetype [System.Runtime]System.Nullable`1<valuetype S1>)
IL_000d: brtrue.s IL_001d
IL_000f: ldloc.0
IL_0010: call valuetype S1 Program::Get2()
IL_0015: call valuetype S1 S1::op_BitwiseAnd(valuetype S1, valuetype S1)
IL_001a: pop
IL_001b: br.s IL_001d
IL_001d: ret
} // end of method Program::Main