[Mono-bugs] [Bug 23126] New - mcs should not allow implicit conversion from int and enum

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
7 Apr 2002 10:08:18 -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=23126

--- shadow/23126	Sun Apr  7 06:08:18 2002
+++ shadow/23126.tmp.11508	Sun Apr  7 06:08:18 2002
@@ -0,0 +1,42 @@
+Bug#: 23126
+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: mcs should not allow implicit conversion from int and enum
+
+The following example compiles but it should not:
+
+   class Test
+   {
+     enum Zub :int
+     {
+        Foo = 99,
+        Bar,
+        Baz
+      }
+
+
+      static void Main()
+      {
+         int foo = 0 + Zub.Foo;
+         System.Console.WriteLine("Foo : {0}", foo);
+
+       } 
+   }
+
+If the assignment is changed to:
+  int foo = Zub.Foo;
+
+the error is correctly flagged.