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

test-688.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5907aee9da9ecd7f075e48dede6d984b3d1a0f6d (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
// Compiler options: -unsafe

using System;

unsafe class Test
{
	public static unsafe byte* GetFoo ()
	{
		byte *one = (byte*)1;
		return 1 + one;
	}

	public static unsafe byte* GetFoo2 ()
	{
		byte *one = (byte*)3;
		return one + 3;
	}

	public static int Main()
	{
		int b = (int)GetFoo ();
		Console.WriteLine (b);
		if (b != 2)
			return 1;

		b = (int)GetFoo2 ();
		Console.WriteLine (b);
		if (b != 6)
			return 2;

		return 0;
	}
}