[Mono-bugs] [Bug 32220][Nor] New - unsafe context not detected correctly with delegates

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
13 Oct 2002 09:46:24 -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 vladimir@pobox.com.

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

--- shadow/32220	Sun Oct 13 05:46:24 2002
+++ shadow/32220.tmp.11331	Sun Oct 13 05:46:24 2002
@@ -0,0 +1,43 @@
+Bug#: 32220
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: unsafe context not detected correctly with delegates
+
+/*t15.cs*/
+using System.Runtime.InteropServices;
+
+public class Driver {
+        public unsafe delegate void FooDelegate (int *someptr);
+
+        public unsafe static void FooFunc (int *someptr) {
+        }
+
+        [DllImport("somelib")]
+        public extern unsafe static void call_foo (FooDelegate a_foo);
+
+        public static void Main () {
+                call_foo (new FooDelegate (FooFunc));
+        }
+}
+/*end*/
+
+
+Compiles with no complaints with mcs /unsafe.  With csc, gives:
+
+t15.cs(13,30): error CS0214: Pointers may only be used in an unsafe context
+
+FooFunc/FooDelegate both use pointers, but it's not being detected in the
+delegate creation.