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

test-705.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e1d3eae12da167df6f88b445d1f2351af44e04f (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
using System;
using System.Collections.Generic;

class Test
{
	public static int Counter = 0;
	
	public struct Nested : IDisposable
	{
		public int Current { get { return 1; } }
		public bool MoveNext ()
		{
			return false;
		}
		
		public void Reset ()
		{
		}

		void IDisposable.Dispose()
		{
			Counter++;
		}

		public void Dispose()
		{
			throw new ApplicationException ("error");
		}
	}

	public Nested GetEnumerator ()
	{
		return new Nested ();
	}
}

public static class Program
{
	public static int Main ()
	{
		Test t = new Test ();
		
		foreach (int i in t) {
		}
		
		if (Test.Counter != 1)
			return 1;
		
		return 0;
	}
}