Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-585.cs
1 using System;
2
3 struct S
4 {
5         public static implicit operator int (S arg)
6         {
7                 throw new ApplicationException ();
8         }
9 }
10
11 struct S2
12 {
13         public static implicit operator int?(S2 arg)
14         {
15                 return 10000;
16         }
17
18         public static implicit operator uint?(S2 arg)
19         {
20                 throw new ApplicationException ();
21         }
22 }
23
24 public struct S3
25 {
26         public static int counter;
27         
28         public static implicit operator string (S3 s3)
29         {
30                 counter++;
31                 return "";
32         }
33 }
34
35 class C
36 {
37         public static int Main ()
38         {
39                 S? s = null;
40                 bool res = s > 1;
41                 if (res)
42                         return 1;
43
44                 S2 s2 = new S2 ();
45
46                 var b = s2 >> 3;
47                 if (b != 1250)
48                         return 2;
49
50                 var b2 = s2 >> s2;
51                 if (b2 != 0)
52                         return 3;
53
54                 var b3 = s2 + 1;
55                 if (b3 != 10001)
56                         return 4;
57
58                 var s3 = new S3 ();
59                 if ((s3 == null) != false)
60                         return 5;
61
62                 if ((s3 != null) != true)
63                         return 6;
64                 
65                 if (S3.counter != 2)
66                         return 7;
67
68                 Console.WriteLine ("ok");
69                 return 0;
70         }
71 }