[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-786.cs
1 using System;
2
3 public class A
4 {
5         public static int Counter;
6         public static implicit operator string (A c)
7         {
8                 ++Counter;
9                 return "A-class";
10         }
11                 
12         public static implicit operator Delegate (A c)
13         {
14                 return null;
15         }
16 }
17         
18 public struct B
19 {
20         public static int Counter;
21         public static implicit operator string (B c)
22         {
23                 ++Counter;
24                 return "B-struct";
25         }
26 }
27
28 public struct D
29 {
30         public static int Counter;
31         public static implicit operator Delegate (D d)
32         {
33                 ++Counter;
34                 return null;
35         }
36 }
37
38 public struct E
39 {
40         public static int Counter;
41         public static implicit operator bool (E d)
42         {
43                 ++Counter;
44                 return true;
45         }
46 }
47
48 public class F
49 {
50         public static implicit operator bool (F f)
51         {
52                 throw new ApplicationException ();
53         }
54 }
55
56 class Program
57 {       
58         public static int Main ()
59         {
60                 if (new B () != new B () || B.Counter != 2)
61                         return 1;
62                 
63                 if (new B () != "B-struct" || B.Counter != 3)
64                         return 2;
65                 
66                 if (new B () == null || B.Counter != 4) {
67                         // FIXME: Incorrect null lifting
68                         //return 3;
69                 }
70
71                 if (new D () != new D () || D.Counter != 2)
72                         return 10;
73
74                 if (new D () != null || D.Counter != 3) {
75                         // FIXME: Incorrect null lifting
76                         //return 11;
77                 }
78                 
79                 if (new A () != "A-class" || A.Counter != 1)
80                         return 20;
81                 
82                 if (new A () == null  || A.Counter != 1)
83                         return 21;
84
85                 if (new E () != new E ()  || E.Counter != 2)
86                         return 31;
87
88                 if (new F () == new F ())
89                         return 40;
90                 
91                 Console.WriteLine ("ok");
92                 return 0;
93         }
94 }