Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-705.cs
1 using System;
2 using System.Collections.Generic;
3
4 class Test
5 {
6         public static int Counter = 0;
7         
8         public struct Nested : IDisposable
9         {
10                 public int Current { get { return 1; } }
11                 public bool MoveNext ()
12                 {
13                         return false;
14                 }
15                 
16                 public void Reset ()
17                 {
18                 }
19
20                 void IDisposable.Dispose()
21                 {
22                         Counter++;
23                 }
24
25                 public void Dispose()
26                 {
27                         throw new ApplicationException ("error");
28                 }
29         }
30
31         public Nested GetEnumerator ()
32         {
33                 return new Nested ();
34         }
35 }
36
37 public static class Program
38 {
39         public static int Main ()
40         {
41                 Test t = new Test ();
42                 
43                 foreach (int i in t) {
44                 }
45                 
46                 if (Test.Counter != 1)
47                         return 1;
48                 
49                 return 0;
50         }
51 }