[Mono-bugs] [Bug 42273][Nor] New - Pointer operations without unsafe context

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Fri, 2 May 2003 17:06:15 -0400 (EDT)


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 jlaban@wanadoo.fr.

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

--- shadow/42273	Fri May  2 17:06:15 2003
+++ shadow/42273.tmp.9368	Fri May  2 17:06:15 2003
@@ -0,0 +1,34 @@
+Bug#: 42273
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jlaban@wanadoo.Fr               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Pointer operations without unsafe context
+
+The following C# code :
+
+public void Test() {
+    byte[] data = new byte[] { 0 };
+    fixed (byte *pb = data) {
+        IntPtr a = new IntPtr((void*)pb);
+    }
+}
+
+Compiled with mcs produces the following message :
+
+    error CS0030: Cannot convert type 'byte*' to 'void*'
+
+While it should display :
+
+    error CS0214: Pointers may only be used in an unsafe context