add bug info
[mcs.git] / tests / gtest-381.cs
blob0a6275d27a78084e8a34f220951af6ab97232347
1 using System.Collections.Generic;
3 class TestGoto
5 static int x = 2;
7 static void Main(string[] args)
9 foreach (bool b in test())
11 if (x != 0)
12 throw new System.Exception ();
15 static IEnumerable<bool> setX()
17 x = 1;
18 try {
19 yield return true;
20 } finally {
21 x = 0;
25 static IEnumerable<bool> test()
27 foreach (bool b in setX()) {
28 yield return true;
29 // Change "goto label" to "break" to show the correct result.
30 goto label;
32 label:
33 yield break;