]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail6795.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail6795.d
1 // 6795
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail6795.d(12): Error: constant 0 is not an lvalue
6 fail_compilation/fail6795.d(13): Error: constant 0 is not an lvalue
7 ---
8 */
9
10 void main() {
11 enum int[] array = [0];
12 array[0]++;
13 array[0] += 3;
14 }
15
16 /*
17 TEST_OUTPUT:
18 ---
19 fail_compilation/fail6795.d(31): Error: constant 0 is not an lvalue
20 fail_compilation/fail6795.d(32): Error: constant 0 is not an lvalue
21 fail_compilation/fail6795.d(33): Error: constant 0 is not an lvalue
22 ---
23 */
24
25 void test_wrong_line_num()
26 {
27 enum int[] da = [0];
28 enum int[1] sa = [0];
29 enum int[int] aa = [0:0];
30
31 da[0] += 3;
32 sa[0] += 3;
33 aa[0] += 3;
34 }