Merge pull request #5636 from BrzVlad/fix-xmm-scan
[mono.git] / mcs / tests / test-474.cs
1 // Test for bug 76550 -- EmitAssign getting called
2 // on captured params.
3
4 class Z {
5         public static void Main ()
6         {
7                 TestPreinc (1);
8                 TestPostinc (1);
9         }
10         
11         delegate void X ();
12
13         static void TestPreinc (int i)
14         {
15                 Assert (i, 1);
16                 X x = delegate {
17                         int z = ++i;
18                         Assert (z, 2);
19                         Assert (i, 2);
20                 };
21                 x ();
22                 Assert (i, 2);
23         }
24
25         static void TestPostinc (int i)
26         {
27                 Assert (i, 1);
28                 X x = delegate {
29                         int z = i++;
30                         Assert (z, 1);
31                         Assert (i, 2);
32                 };
33                 x ();
34                 Assert (i, 2);
35         }
36         
37         static void Assert (int a, int b)
38         {
39                 if (a == b)
40                         return;
41
42                 throw new System.Exception ("Incorrect was: " + a + " should have been " + b + ".");
43         }
44 }