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

test-65.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4ba623a1c6f1abb68080c3b6b9d1a11b956ad42b (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
//
// This exercises the various ways in which the new operator works
// with value types.
//

using System;

struct S {
	int v;
}

class X {
	static bool receive, create, create_and_box;
	
	static void receiver (S x)
	{
		receive = true;
	}

	static object BoxS ()
	{
		create_and_box = true;
		return new S ();
	}

	static S Plain ()
	{
		create = true;
		return new S ();
	}
	
	public static int Main ()
	{
		object a = new S ();
		receiver (new S ());
		S s = Plain ();
		object o = BoxS ();
		
		if (a == null)
			return 1;
		if (receive == false)
			return 2;
		if (create == false)
			return 3;
		if (create_and_box == false)
			return 4;

		Console.WriteLine ("Test pass");
		return 0;
	}
}