Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-121.cs
1 //
2 // This test excercises the fact that array evaluation in UnaryMutator and 
3 // CompoundAssign expressions should never mutate data more than once
4 //
5 class X {
6         static int g_calls;
7         
8         static int g ()
9         {
10                 g_calls++;
11                 return 0;
12         }
13
14         
15         public static int Main ()
16         {
17                 int [] a = new int [10];
18                 int i = 0;
19                 
20                 a [0] = 1;
21
22                 a [i++] += 3;
23
24                 if (i != 1)
25                         return 1;
26                 if (a [0] != 4)
27                         return 2;
28
29                 a [g ()]++ ;
30
31                 if (g_calls != 1)
32                         return 3;
33                 return 0;
34         }
35 }