[Mono-bugs] [Bug 75557][Nor] New - CS0252/CS0253 are not reported when performing reference comparison

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jul 15 10:45:34 EDT 2005


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 gert.driesen at pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=75557

--- shadow/75557	2005-07-15 10:45:34.000000000 -0400
+++ shadow/75557.tmp.30361	2005-07-15 10:45:34.000000000 -0400
@@ -0,0 +1,43 @@
+Bug#: 75557
+Product: Mono: Compilers
+Version: 1.0
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0252/CS0253 are not reported when performing reference comparison
+
+Mcs currently does not report CS0252/CS0253 when comparing a string with 
+an object.
+
+To reproduce this issue, compile the following code snippet:
+
+using System;
+
+class X {
+	static void Main() {
+		object a = "11";
+		Console.WriteLine("11" == a);
+		Console.WriteLine(a == "11");
+	}
+}
+
+Expected result:
+
+test.cs(6,21): warning CS0253: Possible unintended reference comparison; 
+to get a value comparison, cast the right hand side to type 'string'
+test.cs(7,21): warning CS0252: Possible unintended reference comparison; 
+to get a value comparison, cast the left hand side to type 'string'
+
+Actual result:
+
+No warnings.


More information about the mono-bugs mailing list