public override Expression ConvertResult (ResolveContext ec, Binary b)
{
if (left != null) {
- b.left = EmptyCast.Create (b.left, left);
+ b.left = Convert.UserDefinedConversion (ec, b.left, left, Convert.UserConversionRestriction.ImplicitOnly, b.loc) ?? EmptyCast.Create (b.left, left);
} else if (right != null) {
- b.right = EmptyCast.Create (b.right, right);
+ b.right = Convert.UserDefinedConversion (ec, b.right, right, Convert.UserConversionRestriction.ImplicitOnly, b.loc) ?? EmptyCast.Create (b.right, right);
}
TypeSpec r_type = ReturnType;
--- /dev/null
+// Compiler options: -unsafe
+
+using System;
+
+struct nint
+{
+ public static nint operator * (nint a, nint b)
+ {
+ return a;
+ }
+
+ public static implicit operator long (nint v)
+ {
+ return 0;
+ }
+}
+
+class X
+{
+ public static void Main ()
+ {
+ nint width;
+ nint bytesPerRow;
+
+ unsafe {
+ var da = (uint*)0;
+ var dp1 = da + width * bytesPerRow;
+ var dp2 = width * bytesPerRow + da;
+ }
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="test-940.cs">
+ <type name="nint">
+ <method name="nint op_Multiply(nint, nint)" attrs="2198">
+ <size>10</size>
+ </method>
+ <method name="Int64 op_Implicit(nint)" attrs="2198">
+ <size>11</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="Void Main()" attrs="150">
+ <size>46</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-95.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">