[mcs] Initial by ref returns and variables support
[mono.git] / mcs / tests / test-ref-05.cs
1 class X
2 {
3         static int field;
4
5         public static int Main ()
6         {
7                 Test () = 3;
8
9                 if (field != (byte) 3)
10                         return 1;
11
12                 G<string>.Test (ref field) = 6;
13                 if (field != 6)
14                         return 2;
15
16                 --Test ();
17                 if (field != 5)
18                         return 3;
19
20                 Test (ref Test (), ref Test ());
21
22                 return 0;
23         }
24
25         static ref int Test ()
26         {
27                 return ref field;
28         }
29
30         static void Test<T> (ref T a, ref int b)
31         {
32         }
33
34         static void Test2<T> (ref T arg)
35         {
36                 Test (ref arg, ref Test ());
37         }
38 }
39
40 class G<U>
41 {
42         public static ref T Test<T> (ref T arg)
43         {
44                 return ref arg;
45         }
46 }