cleol
[mcs.git] / tests / test-anon-33.cs
blob6537567f5a050ed0b38fe31366facab0cf657343
1 //
2 // This test showed that there were cases where there was no
3 // shared "ScopeInfo", and that we could not root and keep a "topmost"
4 // variable in the compiler for a CaptureContext.
5 //
6 // This illustrates two roots of captured scopes, independent of
7 // each other
8 //
10 using System;
12 delegate void Do ();
14 class T {
15 static void doit (int v) {
16 Console.WriteLine (v);
18 static void Main () {
19 Do[] arr = new Do [5];
20 for (int i = 0; i < 5; ++i) {
21 arr [i] = delegate {doit (i);};
23 for (int i = 0; i < 5; ++i) {
24 arr [i] ();
27 for (int j = 0; j < 5; ++j) {
28 arr [j] = delegate {doit (j);};