[Mono-bugs] [Bug 21096] New - Enum casting problem
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
26 Feb 2002 20:47:53 -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 f_ai@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=21096
--- shadow/21096 Tue Feb 26 15:47:53 2002
+++ shadow/21096.tmp.16915 Tue Feb 26 15:47:53 2002
@@ -0,0 +1,55 @@
+Bug#: 21096
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: f_ai@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Enum casting problem
+
+Description of Problem:
+There is a problem when using an enum as the target or the source for
+casting, sometimes can't convert and others a crash is produced depending
+on the other type involved in the casting.
+
+Additional Information:
+Using snapshot of Feb-25-02.
+
+Source code to reproduce the problem:
+namespace N1
+{
+ public enum A
+ {
+ A_1, A_2, A_3
+ }
+
+ public class B
+ {
+ void ShortCasting ()
+ {
+ short i = 0;
+ N1.A a = N1.A.A_1;
+
+ i = (short) a; //<- crash
+ a = (N1.A)i;//<- fails, can't convert
+ }
+
+ void IntCasting ()
+ {
+ int i = 0;
+ N1.A a = N1.A.A_1;
+
+ i = (int) a;//<- works fine
+ a = (N1.A)i;//<- fails, can't convert
+ }
+ }
+}