[Mono-bugs] [Bug 80581][Nor] New - Unable to compare a struct to null

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jan 22 12:41: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 pawel.sakowski at mindbreeze.com.


--- shadow/80581	2007-01-22 12:41:31.000000000 -0500
+++ shadow/80581.tmp.16517	2007-01-22 12:41:31.000000000 -0500
@@ -0,0 +1,45 @@
+Bug#: 80581
+Product: Mono: Compilers
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: pawel.sakowski at mindbreeze.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Unable to compare a struct to null
+Description of Problem:
+gmcs is unable to compare value types to null.
+Steps to reproduce the problem:
+1. Attempt to compile the following code:
+class X{static void Main(){
+if (System.DateTime.Now == null);
+Actual Results:
+struct-vs-null.cs(2,1): warning CS0642: Possible mistaken empty statement
+struct-vs-null.cs(2,21): error CS0019: Operator `==' cannot be applied to
+operands of type `System.DateTime' and `null'
+Compilation failed: 1 error(s), 1 warnings
+Expected Results:
+A successful compilation (the warning is O.K.)
+How often does this happen?
+Additional Information:
+csc compiles the same code successfully.
+mono 1.2
+How pointless such a comparison is is beyond the scope of this report.

More information about the mono-bugs mailing list