[mcs] Pending implementation of accessors cannot hide base implementation with differ...
[mono.git] / mcs / tests / test-275.cs
index f3f047b68b2b41dcf455815b2aedca8ebea66bf5..80b5393759abe4b086e0029b96ab33b65a0ee9d7 100644 (file)
@@ -1,29 +1,36 @@
-using System; 
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System;
 
-public class Test 
-{ 
-       public delegate void DelType(); 
-       public event DelType MyEvent; 
-       public static int Main()
-        {
-                EventInfo ei = typeof(Test).GetEvent ("MyEvent");
-               MethodImplAttributes methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags();
-            
-                if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
-                    Console.WriteLine ("FAILED");
-                    return 1;
-                }
+public delegate int DelType ();
 
-                methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags();
-                if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
-                    Console.WriteLine ("FAILED");
-                    return 2;
-                }
+struct S
+{
+       public event DelType MyEvent;
+       public static event DelType MyEventStatic;
+       
+       public int RunInstance ()
+       {
+               return MyEvent ();
+       }
+       
+       public int RunStatic ()
+       {
+               return MyEventStatic ();
+       }
+}
 
-                return 0;
-        } 
+public class Test
+{
+       public static int Main ()
+       {
+               S.MyEventStatic += delegate () { return 22; };
+               S s = new S ();
+               s.MyEvent += delegate () { return 6; };
+               if (s.RunInstance () != 6)
+                       return 1;
+               
+               if (s.RunStatic () != 22)
+                       return 2;
+               
+               return 0;
+       }
 }