Merge pull request #3979 from radical/fix-xbuild-tgt
[mono.git] / mcs / tests / gtest-358.cs
index a933995b4a77ecf7b589ed55739f73f2aba1f750..631dfb89c55ab89e312a5e0fb2e8d69395adb35a 100644 (file)
@@ -6,25 +6,66 @@ struct Foo
 {
        public static bool operator == (Foo d1, Foo d2)
        {
-               return false;
+               throw new ApplicationException ();
        }
                
        public static bool operator != (Foo d1, Foo d2)
        {
-               return true;
+               throw new ApplicationException ();      
        }
 }
 
+struct S2
+{
+       public static bool operator == (S2 d1, S2? d2)
+       {
+               throw new ApplicationException ();
+       }
+               
+       public static bool operator != (S2 d1, S2? d2)
+       {
+               throw new ApplicationException ();      
+       }
+}
+
+public struct S3
+{
+       public static decimal operator != (S3 a, object b)
+       {
+               return -1;
+       }
+       
+       public static decimal operator == (S3 a, object b)
+       {
+               return 1;
+       }
+}
+
+
 public class Test
 {
        static Foo ctx;
+       static S2? s2;
+       static S3? s3;
 
-       public static void Main ()
+       public static int Main ()
        {
                if (ctx == null)
-                       return;
+                       return 1;
+               
+               bool b = ctx != null;
+               if (!b)
+                       return 2;
+               
+               if (s2 != null)
+                       return 3;
+               
+               s3 = new S3 ();
+               decimal d = s3.Value == null;
+               if (d != 1)
+                       return 4;
                
-               if (ctx != null)
-                       return;
+               Console.WriteLine ("ok");
+               return 0;
        }
 }