repo.or.cz
/
mono-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
update readme (#21797)
[mono-project.git]
/
mcs
/
tests
/
test-121.cs
blob
5fa9778d6dc1ca48733cd754f5b44ca48742daea
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
}