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
14 static int IncByRef(ref int i
) { return ++i; }
16 public CtorInc() { IncByRef(ref x); ++y; }
18 public static bool Results(int total
)
20 Console
.WriteLine("CtorInc test {0}: x == {1}, y == {2}",
21 x
== y
&& x
== total
? "passed": "failed", x
, y
);
23 return x
== y
&& x
== total
;
29 public static int Main()
34 CtorInc t
= new CtorInc();
36 return CtorInc
.Results(i
) ? 0 : 1;