[Mono-bugs] [Bug 59800][Nor] Changed - Some IntPtr and UIntPtr casts supported by csc are not supported by mcs

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Aug 11 10:03:47 EDT 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 kornelpal at gmail.com.

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

--- shadow/59800	2006-08-11 09:58:25.000000000 -0400
+++ shadow/59800.tmp.2663	2006-08-11 10:03:47.000000000 -0400
@@ -11,13 +11,13 @@
 AssignedTo: miguel at ximian.com                            
 ReportedBy: lupus at ximian.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: error compiling cast from ulong to IntPtr
+Summary: Some IntPtr and UIntPtr casts supported by csc are not supported by mcs
 
 This test doesn't compile with mcs, but it should compile just fine.
 class T {
 	static void Main () {
 		ulong ul = 0;
 		System.IntPtr ptr = (System.IntPtr)ul;
@@ -85,6 +85,62 @@
 
 
 ------- Additional Comments From kornelpal at gmail.com  2006-08-11 09:58 -------
 Created an attachment (id=17444)
 ConversionTestWorking.exe
 
+
+------- Additional Comments From kornelpal at gmail.com  2006-08-11 10:03 -------
+csc has the result:
+Cannot convert type 'void*' to 'float'
+Cannot convert type 'void*' to 'double'
+Cannot convert type 'void*' to 'char'
+Cannot convert type 'void*' to 'decimal'
+Cannot convert type 'System.UIntPtr' to 'System.IntPtr'
+Cannot convert type 'System.IntPtr' to 'System.UIntPtr'
+Cannot convert type 'float' to 'void*'
+Cannot convert type 'double' to 'void*'
+Cannot convert type 'char' to 'void*'
+Cannot convert type 'decimal' to 'void*'
+
+mcs has the result:
+Cannot convert type 'System.UIntPtr' to 'sbyte'
+Cannot convert type 'System.UIntPtr' to 'short'
+Cannot convert type 'System.UIntPtr' to 'int'
+Cannot convert type 'System.IntPtr' to 'ulong'
+Cannot convert type 'void*' to 'float'
+Cannot convert type 'void*' to 'double'
+Cannot convert type 'void*' to 'char'
+Cannot convert type 'void*' to 'decimal'
+Cannot convert type 'ulong' to 'System.IntPtr'
+Cannot convert type 'System.UIntPtr' to 'System.IntPtr'
+Cannot convert type 'sbyte' to 'System.UIntPtr'
+Cannot convert type 'short' to 'System.UIntPtr'
+Cannot convert type 'int' to 'System.UIntPtr'
+Cannot convert type 'System.IntPtr' to 'System.UIntPtr'
+Cannot convert type 'float' to 'void*'
+Cannot convert type 'double' to 'void*'
+Cannot convert type 'char' to 'void*'
+Cannot convert type 'decimal' to 'void*'
+
+csc supports the following conversions that are not supported by mcs:
+UIntPtr->SByte
+UIntPtr->Int16
+UIntPtr->Int32
+IntPtr->UInt64
+UInt64->IntPtr
+SByte->UIntPtr
+Int16->UIntPtr
+Int32->UIntPtr
+
+I think we should support these conversions even when they are non-
+standard because they make mcs compatible with csc as well as make 
+IntPtr and UIntPtr more like other integer types making the 
+conversion table complete.
+
+I miss IntPtr<->UIntPtr conversion because these two type are the 
+same on the stack and signed<->unsigned coversions exist for all 
+other integer types but I think we shouldn't implement that for 
+compatibility reasons.
+
+As a reference on how the missing conversions are implemented in csc 
+see ConversionTestWorking.exe.


More information about the mono-bugs mailing list