aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/expr_constexpr.bad
blob: 51b5189f1013efb81e522e3f4c65333ad5c0290f (plain)
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

int#[4] arr_flat = [11, 22, 33, 44];
int#[2,2] arr_nested = [[11, 12], [21, 22]];
var count testvar = 1;

/* ERRORS */
int arr_a = arr_flat#[-1];
int arr_b = arr_flat#[4];
int arr_c = arr_nested#[0,-1];
int arr_d = arr_nested#[0,2];
int arr_e = arr_nested#[2,0];
int arr_f = arr_flat#[0x];
int arr_g = arr_nested#[0];
int arr_h = arr_nested#[];
int arr_i = arr_nested#[2];
int arr_j = arr_nested#[testvar];
int arr_k = arr_flat#[testvar];

/* ERRORS */
count test_a = testvar;
count test_b = testvar+1;

/* At least one error in the following lines should be reported, but it
   which line doens't matter (or if an error is reported for all of them) */
/* ERRORS */
int cycle_a = cycle_b + 1;
int cycle_b = cycle_c;
int cycle_c = 1 + cycle_d;
int cycle_d = cycle_e;
int cycle_e = cycle_a;

typedef StructType1 = (int x, int y);
StructType1 st1 = (12, 34);
int stbad = st1.z; // ERROR nonexistent member
int badexpr1 = -(-); // ERROR broken expression (should not attempt to evaluate)
int use_bad = arr_f + arr_h + badexpr1;

(int, int x) anonmember = (123, 456);
int use_anon_member = anonmember.x;