diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/nothrow1.C')
-rw-r--r-- | gcc/testsuite/g++.dg/opt/nothrow1.C | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/nothrow1.C b/gcc/testsuite/g++.dg/opt/nothrow1.C new file mode 100644 index 00000000000..fb6c6040408 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nothrow1.C @@ -0,0 +1,24 @@ +// Test that the nothrow optimization works properly. +// { dg-do compile } +// { dg-options "-O -fdump-tree-optimized" } + +extern void blah() throw(); + +int i, j, k; + +int main() +{ + try + { + ++i; + blah(); + ++j; + } + catch (...) + { + return 42; + } +} + +// The catch block should be optimized away. +// { dg-final { scan-tree-dump-times "42" 0 "optimized" } } |