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

test-ref-08.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f4ff50f4c5c5f9be5e640216edf46fb44a02f72d (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
using System;

namespace ClassLibrary1
{
	public class C
	{

		class B
		{
			int v;
			public ref int this[int index]
			{
				get
				{
					return ref v;
				}
			}
		}


		class Gen<T> where T : struct
		{
			T v;
			public ref T this[int index]
			{
				get
				{
					return ref v;
				}
			}
		}

		struct Val
		{
		}

		class BB
		{
			Val v;
			public ref Val this[int index]
			{
				get
				{
					return ref v;
				}
			}
		}

		void MM ()
		{
			var bbb = new BB();
			Val v1 = bbb[0];
			bbb[1] = v1;

			ref Val v2 = ref bbb[2];
			bbb[2] = v2;
		}

		static int[] a = new int[1];
		public static void Main()
		{
			var bb = new B();
			int b = 1;
			bb[0] = b;
			a[0] = Add2(ref b, 2);

			var bbb = new BB();
			bbb[0] = new Val();

			var v = new Val();
			bbb[1] = v;

			var v2 = bbb[2];

			bbb[3] = v2;


			bbb[3] = bbb[2];



			var ggg = new Gen<Val>();
			ggg[0] = new Val();

			var g = new Val();
			ggg[1] = v;

			var g2 = ggg[2];

			ggg[3] = v2;


			ggg[3] = ggg[2];
		}

		public static ref int Add2(ref int a, int b)
		{
			return ref a;
		}
	}
}