summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-226.cs
blob: 6c9d89afeedc63d81ff4683967d5676b64bc3a0e (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
using System;
using System.Reflection;

public struct Container<T>
{
	public T content;

	public Container (T content)
	{
		this.content = content;
	}
}

public class A
{
	public Container<long> field;

	public A ()
	{
		field = new Container<long> (0xdeadbeaf);
	}
}

public class M
{
	public static int Main()
	{
		A a = new A();

		if (a.field.content != 0xdeadbeaf)
			return 1;

		FieldInfo fi = a.GetType().GetField("field");
		object o = fi.GetValue (a);
		Container<long> unboxed = (Container<long>) o;

		if (unboxed.content != 0xdeadbeaf)
			return 2;

		return 0;
	}
}