mail-archives/mono-bugs/2002-February/000027.html

120 строки
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 21096] New - Enum casting problem
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40rocky.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="000026.html">
<LINK REL="Next" HREF="000028.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 21096] New - Enum casting problem
</H1>
<B>bugzilla-daemon@rocky.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40rocky.ximian.com"
TITLE="[Mono-bugs] [Bug 21096] New - Enum casting problem">bugzilla-daemon@rocky.ximian.com
</A><BR>
<I>26 Feb 2002 20:47:53 -0000</I>
<P><UL>
<LI> Previous message: <A HREF="000026.html">[Mono-bugs] [Bug 21069] Changed - Crash when interface method have a ref parameter.
</A></li>
<LI> Next message: <A HREF="000028.html">[Mono-bugs] [Bug 21061] Changed - mcs doesn't always box value types
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#27">[ date ]</a>
<a href="thread.html#27">[ thread ]</a>
<a href="subject.html#27">[ subject ]</a>
<a href="author.html#27">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:f_ai@hotmail.com.">f_ai@hotmail.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=21096">http://bugzilla.ximian.com/show_bug.cgi?id=21096</A>
--- 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: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+ReportedBy: <A HREF="mailto:f_ai@hotmail.com">f_ai@hotmail.com</A>
+QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+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; //&lt;- crash
+ a = (N1.A)i;//&lt;- fails, can't convert
+ }
+
+ void IntCasting ()
+ {
+ int i = 0;
+ N1.A a = N1.A.A_1;
+
+ i = (int) a;//&lt;- works fine
+ a = (N1.A)i;//&lt;- fails, can't convert
+ }
+ }
+}
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="000026.html">[Mono-bugs] [Bug 21069] Changed - Crash when interface method have a ref parameter.
</A></li>
<LI> Next message: <A HREF="000028.html">[Mono-bugs] [Bug 21061] Changed - mcs doesn't always box value types
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#27">[ date ]</a>
<a href="thread.html#27">[ thread ]</a>
<a href="subject.html#27">[ subject ]</a>
<a href="author.html#27">[ author ]</a>
</LI>
</UL>
</body></html>