[Mono-bugs] [Bug 78324][Nor] New - [GMCS] gmcs generates wrong code for comparing nullable types

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun May 7 12:19:17 EDT 2006

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 vargaz at gmail.com.


--- shadow/78324	2006-05-07 12:19:17.000000000 -0400
+++ shadow/78324.tmp.5585	2006-05-07 12:19:17.000000000 -0400
@@ -0,0 +1,41 @@
+Bug#: 78324
+Product: Mono: Compilers
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: vargaz at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: [GMCS] gmcs generates wrong code for comparing nullable types
+Currently, gmcs creates code which calls the op_Equality and op_Inequality
+operators defined in the Nullable class, however, these methods no longer
+exist in in net 2.0 RTM, so gmcs compiled programs which use these methods
+can't be run on the MS runtime. Instead of these methods, it should generate
+code to call the HasValue (when comparing to null), or the
+GetValueOfDefault methods.
+using System;
+class M {
+  static void f (int? x, int? y) {
+      bool isnull = x == null;  
+	  bool eq = x == y;
+  }
+   static void Main () {
+     f (1, 1);  
+     f (null, null); 
+   } 

More information about the mono-bugs mailing list