[Mono-bugs] [Bug 76256][Wis] Changed - Add warning why an explicit cast from int to UIntPtr doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 17 23:57:15 EST 2006

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 rharinath at novell.com.


--- shadow/76256	2006-01-17 12:43:36.000000000 -0500
+++ shadow/76256.tmp.8511	2006-01-17 23:57:15.000000000 -0500
@@ -3,21 +3,21 @@
 Version: unspecified
 OS: All
 OS Details: 
 Status: REOPENED   
 Severity: Unknown
-Priority: Normal
+Priority: Wishlist
 Component: C#
 AssignedTo: rharinath at novell.com                            
 ReportedBy: kornelpal at hotmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
-Summary: UIntPtr should be converted to int
+Summary: Add warning why an explicit cast from int to UIntPtr doesn't work
 int var1 = 2;
 UIntPtr var2 = (UIntPtr)var1;
 Actual result:
@@ -74,6 +74,17 @@
 produces the same IL code with both compilers as I quoted previously.
 int var1 = 2;
 UIntPtr var2 = (UIntPtr)(ulong)var1;
+------- Additional Comments From rharinath at novell.com  2006-01-17 23:57 -------
+By "cannot be performed", I meant that it cannot happen in a single
+explicit cast according to the rules of the standard.
+Allowing this type of conversion alone, and ensuring that the standard
+is adhered-to in other cases, will complicate the code, IMHO.  Also,
+as you show, it's relatively trivial to fix the issue.
+I'll try to see if I can add a warning about this case.

More information about the mono-bugs mailing list