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 int main(int argc, char **argv) 24 { 25 asm volatile ("nop;nop;nop;nop;nop"); 26 try { 27 try { 28 asm volatile ("nop;nop;nop;nop;nop"); 29 throw ExcA(); 30 } catch (ExcA) { 31 asm volatile ("nop;nop;nop;nop;nop"); 32 printf("catch 2\n"); 33 throw new int(); 34 } 35 } catch (...) { 36 asm volatile ("nop;nop;nop;nop;nop"); 37 printf("catch 1\n"); 38 } 39 40 try { 41 asm volatile ("nop;nop;nop;nop;nop"); 42 try { 43 asm volatile ("nop;nop;nop;nop;nop"); 44 filter_only(argc); 45 } catch (ExcC) { 46 asm volatile ("nop;nop;nop;nop;nop"); 47 printf("caught ExcC\n"); 48 } 49 } catch (ExcG) { 50 asm volatile ("nop;nop;nop;nop;nop"); 51 printf("caught ExcG\n"); 52 } 53 54 return 0; 55 } 56