Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-383.cs
1 using System;
2
3 struct MyTypeA
4 {
5         short b;
6
7         public MyTypeA (short b)
8         {
9                 this.b = b;
10         }
11
12         public static MyTypeA operator + (MyTypeA a, MyTypeA b)
13         {
14                 throw new NotSupportedException ();
15         }
16         
17         public static bool operator == (MyTypeA a, MyTypeA b)
18         {
19                 return true;
20         }
21         
22         public static bool operator != (MyTypeA a, MyTypeA b)
23         {
24                 throw new NotSupportedException ();
25         }
26         
27         public static bool operator > (MyTypeA a, MyTypeA b)
28         {
29                 throw new NotSupportedException ();
30         }
31
32         public static bool operator < (MyTypeA a, MyTypeA b)
33         {
34                 throw new NotSupportedException ();
35         }
36 }
37
38 struct MyTypeB
39 {
40         short b;
41
42         public MyTypeB (short b)
43         {
44                 this.b = b;
45         }
46
47         public static MyTypeB operator + (MyTypeB a, MyTypeB b)
48         {
49                 return a;
50         }
51         
52         public static bool operator == (MyTypeB a, MyTypeB b)
53         {
54                 return true;
55         }
56         
57         public static bool operator != (MyTypeB a, MyTypeB b)
58         {
59                 return false;
60         }
61         
62         public static bool operator > (MyTypeB a, MyTypeB b)
63         {
64                 return false;
65         }
66
67         public static bool operator < (MyTypeB a, MyTypeB b)
68         {
69                 return true;
70         }
71         
72         public static MyTypeB operator & (MyTypeB a, MyTypeB b)
73         {
74                 return a;
75         }
76 }
77
78 class C
79 {
80         public static int Main ()
81         {
82                 MyTypeA? mt = null;
83                 mt = null + mt;
84                 
85                 MyTypeA? mt2 = null;
86                 mt2 = mt2 + null;
87                 bool b = mt2 > null;
88                 bool x = mt2 == null;
89                 
90                 MyTypeB? bt = null;
91                 bt = bt + bt;
92                 if (bt != null)
93                         return 2;
94                         
95                 MyTypeB? b2 = null;
96                 bool bb = b2 == b2;
97                 if (!bb)
98                         return 3;
99                 
100                 MyTypeB? b3 = null;
101                 b3 = b3 & b3;
102                 return 0;
103         }
104 }
105