gcc/testsuite/gdc.test/runnable/testassert_debug.d
raw| 1 | /* |
| 2 | https://issues.dlang.org/show_bug.cgi?id=21598 |
| 3 | |
| 4 | REQUIRED_ARGS: -checkaction=context -debug |
| 5 | PERMUTE_ARGS: |
| 6 | */ |
| 7 | |
| 8 | void main() |
| 9 | { |
| 10 | bool caught; |
| 11 | try |
| 12 | assert(foo(1)); |
| 13 | catch (Throwable) |
| 14 | caught = true; |
| 15 | |
| 16 | assert(caught); |
| 17 | assert(counter == 1); |
| 18 | } |
| 19 | |
| 20 | __gshared int counter; |
| 21 | |
| 22 | int foo(int i) pure nothrow |
| 23 | { |
| 24 | debug counter++; |
| 25 | return i - 1; |
| 26 | } |