gcc/testsuite/g++.dg/opt/nothrow1.C
raw| 1 | // Test that the nothrow optimization works properly. |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-O -fdump-tree-optimized" } |
| 4 | |
| 5 | extern void blah() throw(); |
| 6 | |
| 7 | int i, j, k; |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | try |
| 12 | { |
| 13 | ++i; |
| 14 | blah(); |
| 15 | ++j; |
| 16 | } |
| 17 | catch (...) |
| 18 | { |
| 19 | return -42; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // The catch block should be optimized away. |
| 24 | // { dg-final { scan-tree-dump-times "-42" 0 "optimized" } } |