25 lines · cpp
1// RUN: %clangxx -c -o %t %s2// RUN: %llvm_jitlink -slab-allocate=20Mb %t3//4// REQUIRES: system-darwin && host-arch-compatible5 6// Test that we can throw and catch an exception through a large number of7// stack frames. The number (1022) is chosen to force emission of multiple8// unwind info second-level pages.9 10template <int N>11void f() { try { f<N - 1>(); } catch (...) { throw; } }12 13template <>14void f<0>() { throw 42; }15 16int main(int argc, char *argv[]) {17 try {18 f<1020>();19 } catch (int n) {20 return 42 - n;21 }22 return 1;23}24 25