summaryrefslogtreecommitdiff
path: root/mcs/tests/test-404.cs
blob: c1fa56f67949c455ddc6742dfa4e79b86bfb1773 (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
// Compiler options: -unsafe

unsafe class X {
	static int v;
	static int v_calls;
	
	static int* get_v ()
	{
		v_calls++;
	        fixed (int* ptr = &v)
		{
		    return ptr;
		}
	}
	
	public static int Main ()
	{
		if ((*get_v ())++ != 0)
			return 1;
		if (v != 1)
			return 2;
		if (v_calls != 1)
			return 3;
		return 0;
	}
}