blob: f80b17985755f850b2c1963d9ed603cb97722d25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <iostream>
#include <stdexcept>
extern "C" {
int func() {
try {
throw std::runtime_error("This is a test");
} catch(const std::runtime_error &c) {
std::cerr << c.what() << std::endl;
return 42;
} catch(...) {
std::cerr << "Catch-all must not fire!" << std::endl;
return -1;
}
std::cerr << "Control must not reach past try-catch block!" << std::endl;
return -2;
}
}
|