Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-228.cs
1 //
2 // Test for bug reported on the list.  The bug was that the 
3 // compiler was generating copies of the static variable, before
4 // passing it.  A trick that we do for readonly variables
5 using System;
6
7 namespace BadRefTest
8 {
9
10 public class CtorInc
11 {
12         static int x, y;
13
14         static int IncByRef(ref int i) { return ++i; }
15
16         public CtorInc() { IncByRef(ref x); ++y; }
17
18         public static bool Results(int total)
19         {
20                 Console.WriteLine("CtorInc test {0}: x == {1}, y == {2}",
21                                 x == y && x == total? "passed": "failed", x, y);
22
23                 return x == y && x == total;
24         }
25 }
26
27 public class Runner
28 {
29         public static int Main()
30         {
31                 int i = 0;
32                 for (; i < 5; i++)
33                 {
34                         CtorInc t = new CtorInc();
35                 }
36                 return CtorInc.Results(i) ? 0 : 1;
37         }
38
39 }
40 }
41