1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
int lengthmismatch = [[1,2,3],[4,5,6,7]]#[0,0]; // ERROR
() takearray(int#[3] arr)
{
}
int main()
{
var int#[3] A;
bool bad;
/* ERRORS */
takearray([1, 2]);
/* ERRORS */
A = [4, 5];
A = [4, 5, 6, 7];
A = [bad, bad, bad];
/* ERRORS */
int a = [bad, bad]#[1];
int b = [[1,2], [3,4]]#[1];
int c = [1,2,3]#[1]#[1];
int d = bad#[1];
int e = [1,2,3];
int f = [@[1,2],]#[0]#[1];
int g = [[1,2],]#[0]^#[1];
int h = [[1,2,3],[4,5,6,7]]#[0,0];
int i = []#[0,0];
/* TODO Add checks of array range, preferably both constexpr index
access and more complex index access, like in loops */
// int k = [[]]#[0,0];
// int l = [[] as int#[0]]#[0,0];
/* ERRORS */
takearray([[1,2,3], [4,5,6]]#[0]#[0]);
takearray([[1,2,3], [4,5,6]]);
return 0;
}
|