Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / tests / test-anon-97.cs
1 //
2 // This is a build test: checks that the compiler does not loop
3 // forever endlessly with anonymous methods
4 //
5 using System;
6 using System.Collections;
7 using System.Text;
8
9   class Space
10   { public int Value = -1;
11
12     public delegate void DoCopy();
13
14     public DoCopy CopyIt;
15
16     public void Leak(bool useArray, int max)
17     { DoCopy one;
18
19       { int answer = 0;
20         int[] work;
21         
22         CopyIt = delegate { Value = answer; };
23         one = delegate 
24               { work = new int[max];
25                 foreach(int x in work) answer += x;
26               };
27       }
28
29       one();
30     }
31   }
32
33   class Program
34   { 
35     public static void Main(string[] args)
36     {
37     }
38   }