[Mono-bugs] [Bug 24004] New - reference compare compilation error in mcs

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
29 Apr 2002 17:31:52 -0000


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 lupus@ximian.com.

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

--- shadow/24004	Mon Apr 29 13:31:52 2002
+++ shadow/24004.tmp.18968	Mon Apr 29 13:31:52 2002
@@ -0,0 +1,35 @@
+Bug#: 24004
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: reference compare compilation error in mcs
+
+The following code doesn't compile with mcs. It does with csc with the
+following warning:
+string-equals.cs(8,7): warning CS0252: Possible unintended reference
+comparison; to get a value comparison, cast the left hand side to type
+'string'.
+
+class T {
+        static object get_obj() {
+                return new object ();
+        }
+        static int Main() {
+                object o = get_obj ();
+                if (o == "string")
+                        return 1;
+                return 0;
+        }
+}