Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail125.d(15): Error: sequence index `[2]` is outside bounds `[0 .. 2]`
5 fail_compilation/fail125.d(18): Error: template instance `fail125.main.recMove!(1, a, b)` error instantiating
6 fail_compilation/fail125.d(25): instantiated from here: `recMove!(0, a, b)`
7 ---
8 */
9
10
11 template recMove(int i, X...)
12 {
13 void recMove()
14 {
15 X[i] = X[i+1];
16 // I know the code is logically wrong, should test (i+2 < X.length)
17 static if (i+1 < X.length)
18 recMove!(i+1, X);
19 }
20 }
21
22 void main()
23 {
24 int a, b;
25 recMove!(0, a, b);
26 }