[Mono-bugs] [Bug 34451][Wis] New - mcs - Enum to IntPtr cast failing

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
21 Nov 2002 23:45:35 -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 fgonthier@hermes.usherb.ca.

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

--- shadow/34451	Thu Nov 21 18:45:35 2002
+++ shadow/34451.tmp.14804	Thu Nov 21 18:45:35 2002
@@ -0,0 +1,44 @@
+Bug#: 34451
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: fgonthier@hermes.usherb.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs - Enum to IntPtr cast failing
+
+This sample program doesn't compile with mcs (cvs version of 2002-11-21) 
+while csc returns no error and compiles it fine.
+
+using System;
+
+public class EnumCast {
+
+	public enum SomeEnum {
+		Member1,
+		Member2
+	}
+
+	public static void SomeFunction(IntPtr ParamVar) {
+		Console.WriteLine("You shouldn't see this: " + 
+ParamVar.ToInt32());
+	}
+
+	public static void Main(string[] args) {
+		SomeFunction((IntPtr)SomeEnum.Member1);
+	}
+}
+
+neumann@MinasTirith:~/monocvs$ mcs enum_cast.cs
+enum_cast.cs(15) error CS0030: Cannot convert type 'EnumCast+SomeEnum' 
+to 'System.IntPtr'
+Compilation failed: 1 error(s), 0 warnings