aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/zc0unbounded.zc
blob: 67c3ae05ca1f8a76d24e709d89e42ac21cbeb2d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
namespace;
include rt;

// unbounded in all three places zc0 accepts it (and ignores): the unit, a
// function prefix and a statement. both compilers print the same.
unbounded;
int[4] a;
unbounded int get(int i) { return a[i]; }
int main() {
	int i = 2, r = 0;
	a[2] = 40;
	unbounded r = get(i) + 2;
	unbounded { r = r + a[i - 2]; }
	rt.put_n(r); rt.put_c(10);
	return 0;
}