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