Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-162.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ccb720e40c84985ef0e7b430b01cc313977c3a7 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;

struct A
{
	public int a;
	private long b;
	private float c;

	public A (int foo)
	{
		a = foo;
		b = 8;
		c = 9.0F;
	}
}

struct B
{
	public int a;
}

struct C
{
	public long b;

	public C (long foo)
	{
		b = foo;
	}

	// has `this' initializer, no need to initialize fields.
	public C (string foo)
		: this (500)
	{ }
}

struct D
{
	public int foo;
}

struct E
{
	public D d;
	public bool e;

	public E (int foo)
	{
		this.e = true;
		this.d.foo = 9;
	}
}

struct F
{
	public E e;
	public float f;
}

class X
{
	static void test_output (A x)
	{ }

	static void test_output (B y)
	{ }

	static void test_output (E e)
	{ }

	static void test_output (F f)
	{ }

	static void test1 ()
	{
		A x;

		x.a = 5;
		Console.WriteLine (x.a);
	}

	static void test2 ()
	{
		B y;

		y.a = 5;
		Console.WriteLine (y.a);
		Console.WriteLine (y);
	}

	static void test3 ()
	{
		A x = new A (85);

		Console.WriteLine (x);
	}

	static void test4 (A x)
	{
		x.a = 5;
	}

	static void test5 (out A x)
	{
		x = new A (85);
	}

	static void test6 (out B y)
	{
		y.a = 1;
	}

	static void test7 ()
	{
		E e;
		e.e = true;
		e.d.foo = 5;

		test_output (e);
	}

	static void test8 ()
	{
		F f;
		f.e.e = true;
		f.e.d.foo = 5;
		f.f = 3.14F;

		test_output (f);
	}

	static void test9 ()
	{
		E e = new E (5);
		Console.WriteLine (e.d.foo);
	}

	static void test10 ()
	{
		F f;
		f.e = new E (10);
		Console.WriteLine (f.e.d.foo);
		Console.WriteLine (f.e.d);
		f.f = 3.14F;
		Console.WriteLine (f);
	}

	public static int Main ()
	{
		// Compilation-only test.
		return 0;
	}
}