return this;
}
+ bool no_arg_conv = false;
+
//
// LAMESPEC: method groups can be compared when they convert to other side delegate
//
left = result;
l = r;
+ } else {
+ no_arg_conv = l == r && !l.IsStruct;
}
//
// bool operator != (bool a, bool b)
// bool operator == (bool a, bool b)
//
- // LAMESPEC: Reference equality comparison can apply to value types when
- // they implement an implicit conversion to any of types above.
+ // LAMESPEC: Reference equality comparison can apply to value/reference types when
+ // they implement an implicit conversion to any of types above. This does
+ // not apply when both operands are of same reference type
//
if (r.BuiltinType != BuiltinTypeSpec.Type.Object && l.BuiltinType != BuiltinTypeSpec.Type.Object) {
- result = ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryEquality, false, null);
+ result = ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryEquality, no_arg_conv, null);
if (result != null)
return result;
}
}
}
+public class F
+{
+ public static implicit operator bool (F f)
+ {
+ throw new ApplicationException ();
+ }
+}
+
class Program
{
public static int Main ()
if (new E () != new E () || E.Counter != 2)
return 31;
+
+ if (new F () == new F ())
+ return 40;
Console.WriteLine ("ok");
return 0;
</type>
<type name="Program">
<method name="Int32 Main()">
- <size>372</size>
+ <size>390</size>
+ </method>
+ <method name="Void .ctor()">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="F">
+ <method name="Boolean op_Implicit(F)">
+ <size>6</size>
</method>
<method name="Void .ctor()">
<size>7</size>