[Mono-bugs] [Bug 29517][Nor] New - castclass doesn't allow casting enum[] to underlying type

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
27 Aug 2002 17:50:00 -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=29517

--- shadow/29517	Tue Aug 27 13:50:00 2002
+++ shadow/29517.tmp.8478	Tue Aug 27 13:50:00 2002
@@ -0,0 +1,33 @@
+Bug#: 29517
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: castclass doesn't allow casting enum[] to underlying type
+
+As posted by "Jeroen Frijters" <jeroen@sumatra.nl> on mono-list:
+The following code throws a System.InvalidCastException:
+
+enum MyEnum : int {}
+
+class Bug
+{
+  public static void Main()
+  {
+    int[] a1 = (int[])(object)new MyEnum[1];
+    MyEnum[] a2 = (MyEnum[])(object)new MyEnum[1];
+  }
+}
+
+Partition III section 4.3 (castclass) explicitly allows this conversion.