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