There appears to be a bug in .NET Reflector when handling (a ? b : c) << d.
To reproduce it compile the following code using .NET 3.5:
using System;
class P
{
static void Main()
{
int i = 0;
bool k = false;
int j = (k ? 1 : 0) << i;
Console.WriteLine(j);
}
}
The program should print "0" to the console.
Disassemble the resulting Main() method in the .exe using .NET Reflector 5.1.5.0 and you get this:
private static void Main()
{
int i = 0;
bool k = false;
int j = ((k != null) ? 1 : 0) << i;
Console.WriteLine(j);
}
This program when compiled outputs "1". The main funtion is disassembled incorrectly.
To reproduce it compile the following code using .NET 3.5:
The program should print "0" to the console.
Disassemble the resulting Main() method in the .exe using .NET Reflector 5.1.5.0 and you get this:
This program when compiled outputs "1". The main funtion is disassembled incorrectly.