repo.or.cz
/
mcs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
In ilasm/tests:
[mcs.git]
/
tests
/
test-121.cs
blob
21e96bc967f287e551894ca4c66e2c1e9a127422
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
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
}