1 #include <stdio.h>
2 
3 class ExcA {};
4 class ExcB {};
5 class ExcC {};
6 class ExcD {};
7 class ExcE {};
8 class ExcF {};
9 class ExcG {};
10 
11 void foo(int a)
12 {
13   if (a > 1)
14     throw ExcG();
15   else
16     throw ExcC();
17 }
18 
19 void filter_only(int a) throw (ExcA, ExcB, ExcC, ExcD, ExcE, ExcF) {
20   foo(a);
21 }
22 
23 void never_throws() throw () {
24   printf("this statement is cold and should be outlined\n");
25 }
26 
27 int main(int argc, char **argv)
28 {
29   for(unsigned i = 0; i < 1000000; ++i) {
30     try {
31       if (argc == 2) {
32         never_throws(); // should be cold
33       }
34       try {
35         if (argc == 2) {
36           never_throws(); // should be cold
37         }
38         throw ExcA();
39       } catch (ExcA) {
40         printf("catch 2\n");
41         throw new int();
42       }
43     } catch (...) {
44       printf("catch 1\n");
45     }
46 
47     try {
48       try {
49         filter_only(argc);
50       } catch (ExcC) {
51         printf("caught ExcC\n");
52       }
53     } catch (ExcG) {
54       printf("caught ExcG\n");
55     }
56   }
57 
58   return 0;
59 }
60