Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-22.cs
1 //
2 // This test excercises invocations of methods in structures.
3 //
4 // Unlike classes, we can not just leave the result of a computed
5 // structure in the IL stack as a result.  The reason is that the
6 // result is the whole structure, not a pointer to it.
7 //
8 // This program excercises invocations to methods on structures
9 //
10
11 struct T {
12         public int a, b;
13 }
14
15 struct S {
16         T t;
17
18         public T GetT ()
19         {
20                 return t;
21         }
22
23         public void Init ()
24         {
25                 t.a = 1;
26                 t.b = 2;
27         }
28 }
29
30 class M {
31         public static int Main ()
32         {
33                 S s = new S ();
34
35                 s.Init ();
36                 
37                 if (s.GetT ().a != 1)
38                         return 1;
39
40                 if (s.GetT ().b != 2)
41                         return 2;
42
43                 return 0;
44         }
45 }
46