[Mono-bugs] [Bug 41478][Wis] New - Successful cast of (out of range) int to Enum

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 16 Apr 2003 19:14:35 -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 r.h.lee@attbi.com.

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

--- shadow/41478	Wed Apr 16 19:14:35 2003
+++ shadow/41478.tmp.15939	Wed Apr 16 19:14:35 2003
@@ -0,0 +1,58 @@
+Bug#: 41478
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: r.h.lee@attbi.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Successful cast of (out of range) int to Enum
+
+using System;
+	
+public enum A{
+	a=0,
+	b=1,
+	c=2,
+	d=3,
+}
+
+public class App {
+	public static void Test (A e) {
+
+	}
+	
+	public static void Main () {
+		int notAnEnumValue=1000;
+		App.Test ((A)notAnEnumValue);
+	}
+}
+
+
+Actual Results:
+The app compiles and runs like everythings o k.
+
+
+Expected Results:
+
+1. Shouldn't compile, the invalid cast should throw an exception. [
+InvalidCastException within mcs...]
+
+or
+
+2. Throw an InvalidCastException when the App is running at the invalid cast. 
+
+
+How often does this happen? 
+Always
+
+
+Additional Information: