[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / gtest-078.cs
1 using System;
2
3 struct S : IDisposable
4 {
5         public static int hit;
6
7         void IDisposable.Dispose ()
8         {
9                 hit++;
10         }
11
12         public void Dispose ()
13         {
14                 throw new ApplicationException ();
15         }
16 }
17
18 class C : IDisposable
19 {
20
21         void IDisposable.Dispose ()
22         {
23         }
24
25         public void Dispose ()
26         {
27                 throw new ApplicationException ();
28         }
29 }
30
31 class Test
32 {
33         public static int Main ()
34         {
35                 S? nullable = null;
36                 using (var a = nullable) {
37                 }
38
39                 if (S.hit != 0)
40                         return 1;
41
42                 using (var s = new S ()) {
43                 }
44
45                 if (S.hit != 1)
46                         return 2;
47
48                 C c = null;
49                 GenMethod (c);
50                 
51                 using (S? a = nullable, b = nullable) {
52                 }
53                 
54                 if (S.hit != 1)
55                         return 3;
56
57                 Console.WriteLine ("ok");
58                 return 0;
59         }
60
61         static void GenMethod<T> (T t) where T : IDisposable
62         {
63                 using (T t2 = t) {
64                 }
65         }
66 }