aboutsummaryrefslogtreecommitdiffstats
path: root/test/C++Frontend/EH/simple_rethrow.cpp
blob: 34c46812c1858dd9b2ad1a036c5212c9952ccd74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>

int throws() {
  printf("Throwing int\n");
  throw 16;
};

int callsthrows() {
  try {
    throws();
  } catch (...) {
    printf("Caught something, rethrowing...\n");
    throw;
  }
}

int main() {
  try {
    callsthrows();
  } catch (int i) {
    printf("Caught int: %d\n", i);
    return i-16;
  }
  return 1;
}