Implicit conversion to System.Double with a nullable struct via compiler generated locals: why is this failing?
问题 Given the following, why does the InvalidCastException get thrown? I can't see why it should be outside of a bug (this is in x86; x64 crashes with a 0xC0000005 in clrjit.dll). class Program { static void Main(string[] args) { MyDouble? my = new MyDouble(1.0); Boolean compare = my == 0.0; } struct MyDouble { Double? _value; public MyDouble(Double value) { _value = value; } public static implicit operator Double(MyDouble value) { if (value._value.HasValue) { return value._value.Value; } throw