codeowners update
[mono.git] / mcs / tests / gtest-428.cs
1 using System;
2
3 public struct CInt
4 {
5         int data;
6
7         public CInt (int data)
8         {
9                 this.data = data;
10         }
11
12         public static implicit operator CInt (int xx)
13         {
14                 return new CInt (xx);
15         }
16
17         public static implicit operator int (CInt xx)
18         {
19                 return xx.data;
20         }
21 }
22
23
24 public class Klass
25 {
26         CInt? t;
27         public Klass (CInt? t)
28         {
29                 this.t = t;
30         }
31
32         public CInt? Value
33         {
34                 get
35                 {
36                         return t;
37                 }
38         }
39 }
40
41 public class MainClass
42 {
43         public static int Main ()
44         {
45                 var v = new Klass (new CInt (3));
46
47                 if (v.Value == 1)
48                         return 1;
49
50                 if (v.Value != 3)
51                         return 2;
52
53                 if (v.Value == null)
54                         return 3;
55
56                 var v2 = new Klass (null);
57
58                 if (v2.Value != null)
59                         return 4;
60
61                 Console.WriteLine ("OK");
62                 return 0;
63         }
64 }