summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/nothrow1.C
blob: c1a80822be956db4c0c349cd14e81d639867872a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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" } }
// { dg-final { cleanup-tree-dump "optimized" } }