Debian Codegraph @

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

raw
1 /*
2 REQUIRED_ARGS: -checkaction=context
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail145.d(14): Error: `assert(i && (i < 0))` failed
6 fail_compilation/fail145.d(27): called from here: `bar(7)`
7 ---
8 */
9
10 //import core.stdc.stdio : printf;
11
12 int bar(int i)
13 {
14 assert(i && i < 0);
15 foreach_reverse (k, v; "hello")
16 {
17 i <<= 1;
18 if (k == 2)
19 break;
20 i += v;
21 }
22 return i;
23 }
24
25 void main()
26 {
27 static b = bar(7);
28 auto c = bar(7);
29 //printf("b = %d, %d\n", b, c);
30 assert(b && b == 674);
31 }