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

gtest-352.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3142b3cbe1b8d5855a55175b84cea5d264bd4853 (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
// Compiler options: -o+

using System;
using System.Reflection;

struct D
{
	public static D d1 = new D (1);
	public int d2;

	public D (int v)
	{
		d2 = 0;
	}
}

class T
{
	static int Main ()
	{
		ConstructorInfo mi = typeof(D).GetConstructors (BindingFlags.Instance | BindingFlags.Public)[0];
        MethodBody mb = mi.GetMethodBody();
		
		Console.WriteLine (mb.GetILAsByteArray ().Length);
		if (mb.GetILAsByteArray ().Length != 8) {
			return 1;
		}

		mi = typeof (D).GetConstructors (BindingFlags.Static | BindingFlags.NonPublic) [0];
		mb = mi.GetMethodBody ();

		Console.WriteLine (mb.GetILAsByteArray ().Length);
		if (mb.GetILAsByteArray ().Length != 12) {
			return 2;
		}
			
		Console.WriteLine ("OK");
		return 0;
	}
}