[Mono-bugs] [Bug 60638][Wis] New - missing warning comparing string with object

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Jun 2004 11:48:01 -0400 (EDT)


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=60638

--- shadow/60638	2004-06-23 11:48:01.000000000 -0400
+++ shadow/60638.tmp.13672	2004-06-23 11:48:01.000000000 -0400
@@ -0,0 +1,32 @@
+Bug#: 60638
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: missing warning comparing string with object
+
+mcs compiles the following without warnings.
+csc gives:
+simple-strcomp-bug.cs(6,12): warning CS0253: Possible unintended reference
+comparison; to get a value comparison, cast the right hand side to type
+'string'
+
+class T {
+        static object getit () {
+                return new string (new char[] {'a'});
+        }
+        static void Main () {
+                bool a = "a" == getit ();
+        }
+}