[Mono-bugs] [Bug 81571][Wis] New - implicite conversion to boolean from generic using == does not work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 8 17:37:01 EDT 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 wasabi at larvalstage.net.

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

--- shadow/81571	2007-05-08 17:37:01.000000000 -0400
+++ shadow/81571.tmp.11718	2007-05-08 17:37:01.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 81571
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: wasabi at larvalstage.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: implicite conversion to boolean from generic using == does not work
+
+I have been assured the following code compiles correctly on MS.Net.
+However, I don't have a box at the time to verify it. It doesn't compile
+on Mono 1.2.3... and it appears it should.
+
+
+
+using System;
+
+namespace MonoBug {
+        class MainClass {
+                public static void Main(string[] args) {
+                        Console.WriteLine("Hello World!");
+
+                        GenericType<bool> g = new GenericType<bool>(true);
+                        if (g)
+                                Console.WriteLine("true");
+                        if (g == true)
+                                Console.WriteLine("true");
+                }
+        }
+
+        public class GenericType<T> {
+
+                private T value;
+
+                public GenericType(T value) {
+                        this.value = value;
+                }
+
+                public static implicit operator T(GenericType<T> o) {
+                        return o.value;
+                }
+        }
+}


More information about the mono-bugs mailing list