OSDN Git Service

* gcc.dg/tm/memopt-6.c: Cleanup tmedge tree dump.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / eh / cond5.C
1 // PR c++/49165
2 // { dg-do run }
3
4 extern "C" void abort ();
5
6 int
7 foo (bool x, int y)
8 {
9   if (y < 10 && (x ? true : throw 1))
10     y++;
11   if (y > 20 || (x ? true : throw 2))
12     y++;
13   return y;
14 }
15
16 int
17 main ()
18 {
19   if (foo (true, 0) != 2
20       || foo (true, 10) != 11
21       || foo (false, 30) != 31)
22     abort ();
23   try
24     {
25       foo (false, 0);
26       abort ();
27     }
28   catch (int i)
29     {
30       if (i != 1)
31         abort ();
32     }
33   try
34     {
35       foo (false, 10);
36       abort ();
37     }
38   catch (int i)
39     {
40       if (i != 2)
41         abort ();
42     }
43 }