Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail6795.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=6795
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail6795.d(19): Error: cannot modify expression `[0][0]` because it is not an lvalue
6 fail_compilation/fail6795.d(20): Error: cannot modify expression `[0:0][0]` because it is not an lvalue
7 fail_compilation/fail6795.d(22): Error: cannot modify expression `[0][0]` because it is not an lvalue
8 fail_compilation/fail6795.d(23): Error: cannot modify expression `[0:0][0]` because it is not an lvalue
9 fail_compilation/fail6795.d(25): Error: cannot take address of expression `[0][0]` because it is not an lvalue
10 fail_compilation/fail6795.d(26): Error: cannot take address of expression `[0:0][0]` because it is not an lvalue
11 fail_compilation/fail6795.d(30): Error: cannot modify expression `Some["zz"]` because it is not an lvalue
12 ---
13 */
14 void test_wrong_line_num()
15 {
16 enum int[1] sa = [0];
17 enum int[int] aa = [0:0];
18
19 sa[0]++;
20 --aa[0];
21
22 sa[0] *= 3;
23 aa[0] /= 3;
24
25 auto ps = &sa[0];
26 auto pa = &aa[0];
27
28 // https://issues.dlang.org/show_bug.cgi?id=24845
29 enum Maps : int[string] { Some = ["aa" : 12], Other = ["bb" : 24] }
30 Maps.Some["zz"] = 44;
31 }