Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-584.cs
1 using System;
2
3 enum E : sbyte
4 {
5         V = 1
6 }
7
8 struct S
9 {
10         public static bool operator == (S s, S i)
11         {
12                 throw new ApplicationException ();
13         }
14
15         public static bool operator != (S s, S i)
16         {
17                 throw new ApplicationException ();
18         }
19
20         public static implicit operator int? (S s)
21         {
22                 throw new ApplicationException ();
23         }
24
25         public static implicit operator E? (S s)
26         {
27                 return null;
28         }
29 }
30
31 class C
32 {
33         public static int Main ()
34         {
35                 E? a = E.V;
36                 E? a_n = null;
37                 E? b = E.V;
38                 E? b_n = null;
39
40                 if (a != b)
41                         return 1;
42
43                 if (a == a_n)
44                         return 2;
45
46                 if (a_n != b_n)
47                         return 3;
48                 
49                 E e = (E) 4;
50                 S s;
51                 if (e == s)
52                         return 10;
53
54                 if (s == e)
55                         return 11;
56
57                 if (e > s)
58                         return 12;
59
60                 if (s > e)
61                         return 13;
62
63                 if ((s & e) != null)
64                         return 14;
65
66                 if ((s & e) != null)
67                         return 15;
68
69                 var res1 = (E?) 1 == null;
70                 if (res1)
71                         return 16;
72
73                 var res2 = null == (E?) 1;
74                 if (res2)
75                         return 17;
76
77                 var r1 = a_n & E.V;
78                 if (r1 != null)
79                         return 18;
80
81                 var r2 = E.V & a_n;
82                 if (r2 != null)
83                         return 19;
84
85                 Console.WriteLine ("ok");
86
87                 return 0;
88         }
89 }