52 lines · cpp
1#include <stdio.h>2 3class ExcA {};4class ExcB {};5class ExcC {};6class ExcD {};7class ExcE {};8class ExcF {};9class ExcG {};10 11void foo(int a)12{13 if (a > 1)14 throw ExcG();15 else16 throw ExcC();17}18 19int main(int argc, char **argv)20{21 asm volatile ("nop;nop;nop;nop;nop");22 try {23 try {24 asm volatile ("nop;nop;nop;nop;nop");25 throw ExcA();26 } catch (ExcA) {27 asm volatile ("nop;nop;nop;nop;nop");28 printf("catch 2\n");29 throw new int();30 }31 } catch (...) {32 asm volatile ("nop;nop;nop;nop;nop");33 printf("catch 1\n");34 }35 36 try {37 asm volatile ("nop;nop;nop;nop;nop");38 try {39 asm volatile ("nop;nop;nop;nop;nop");40 foo(argc);41 } catch (ExcC) {42 asm volatile ("nop;nop;nop;nop;nop");43 printf("caught ExcC\n");44 }45 } catch (ExcG) {46 asm volatile ("nop;nop;nop;nop;nop");47 printf("caught ExcG\n");48 }49 50 return 0;51}52