Merge pull request #4998 from kumpera/fix_56684
[mono.git] / mcs / tests / test-318.cs
index c74e02445b88bc994e3e0e5de29642aa94bea8f5..71439f79faa9c237fcf1fbf76ce187a9f0dd10aa 100644 (file)
@@ -1,19 +1,72 @@
 // This code must be compilable without any warning
-// Compiler options: -warnaserror -warn:4
+// Compiler options: -warnaserror -warn:4 -unsafe
+// Test of wrong warnings
 
-public class C
+using System;
+using System.ComponentModel;
+
+public class Ev
 {
-        public static void my_from_fixed(out int val)
+        object disposedEvent = new object ();
+        EventHandlerList Events = new EventHandlerList();
+                
+        public event EventHandler Disposed
         {
-            val = 3;
+                add { Events.AddHandler (disposedEvent, value); }
+                remove { Events.RemoveHandler (disposedEvent, value); }
         }
+
+        public void OnClick(EventArgs e)
+        {
+            EventHandler clickEventDelegate = (EventHandler)Events[disposedEvent];
+            if (clickEventDelegate != null) {
+                clickEventDelegate(this, e);
+            }
+        }
+}
+
+public interface EventInterface {
+       event EventHandler Event;
+}
+
+class Foo : EventInterface {
+       event EventHandler EventInterface.Event
+       {
+                       add { }
+                       remove { }
+       }
+}
+
+public class C {
+    
+       public static void my_from_fixed(out int val)
+       {
+               val = 3;
+       }
         
-        public static void month_from_fixed(int date) {
+       public static void month_from_fixed(int date)
+       {
                int year;
                my_from_fixed(out year);
        }
         
-        public static void Main ()
-        {
-        }
+       internal static int CreateFromString (int arg)
+       {
+               int major = 0;
+               int number = 5;
+
+               major = number;
+               number = -1;
+                    
+               return major;
+       }   
+        
+        public unsafe double* GetValue (double value)
+       {
+               double d = value;
+               return &d;
+       }        
+        
+       public static void Main () {
+       }
 }