[Mono-bugs] [Bug 81041][Min] New - missing CS0019: reject == operator for object vs. generic type argument
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Mon Mar 5 15:35:31 EST 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=81041
--- shadow/81041 2007-03-05 15:35:31.000000000 -0500
+++ shadow/81041.tmp.30833 2007-03-05 15:35:31.000000000 -0500
@@ -0,0 +1,74 @@
+Bug#: 81041
+Product: Mono: Compilers
+Version: 1.0
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: atsushi at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: missing CS0019: reject == operator for object vs. generic type argument
+
+With gmcs, the example below does not cause CS0019 (no applicable ==
+operator) error.
+
+--------
+public class Test
+{
+ public static void Main ()
+ {
+ KVP<string,int> p = new KVP<string,int> ();
+ int i;
+ p.TryGet ("", out i);
+ }
+}
+
+public class KVP<K,V>
+{
+ V vvv;
+
+ public bool TryGet (K k, out V v)
+ {
+ object tmp = vvv;
+ if (tmp == default (V))
+ v = default (V);
+ else
+ v = (V) tmp;
+ return true;
+ }
+}
+--------
+
+I read ECMA 334 section 14.9.6 (Reference type equality operators) and I
+think the below term should apply here:
+
+"Otherwise, if either A or B is a type parameter that is not known to be a
+reference type (§25.7), then no reference type equality operator is
+applicable."
+
+
+Actual Results:
+
+no error.
+
+Expected Results:
+
+$ csc test.cs -nologo
+test.cs(18,7): error CS0019: Operator '==' cannot be applied to operands of
+type 'object' and 'V'
+
+How often does this happen?
+
+consistently.
+
+Additional Information:
+
+The compiled assembly, when executed, causes invalid IL on mono, and
+strangely no error on .net ...
More information about the mono-bugs
mailing list