[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-882.cs
1 using System;
2
3 public class MyUInt32
4 {
5         public uint x;
6
7         public MyUInt32 (uint x)
8         {
9                 this.x = x;
10         }
11
12         public static implicit operator uint (MyUInt32 v)
13         {
14                 return v.x;
15         }
16
17         public static implicit operator long (MyUInt32 v)
18         {
19                 throw new ApplicationException ();
20         }
21
22         public static implicit operator MyUInt32 (uint v)
23         {
24                 return new MyUInt32 (v);
25         }
26
27         public static implicit operator MyUInt32 (long v)
28         {
29                 throw new ApplicationException ();
30         }
31 }
32
33 class Test
34 {
35         static MyUInt32 test1 (MyUInt32 x)
36         {
37                 x = x + 1;
38                 return x;
39         }
40
41         static MyUInt32 test2 (MyUInt32 x)
42         {
43                 x++;
44                 return x;
45         }
46
47         static MyUInt32 test3 (MyUInt32 x)
48         {
49                 ++x;
50                 return x;
51         }
52
53         public static int Main ()
54         {
55                 var m = new MyUInt32 (2);
56                 m = test1 (m);
57                 if (m.x != 3)
58                         return 1;
59
60                 m = new MyUInt32 (2);
61                 m = test2 (m);
62                 if (m.x != 3)
63                         return 2;
64
65                 m = new MyUInt32 (3);
66                 m = test3 (m);
67                 if (m.x != 4)
68                         return 3;
69
70                 return 0;
71         }
72 }