xref: /openbsd-src/regress/misc/exceptions/simple2/simple2.cc (revision 746bf85ef77f47f1e658d909fa3ddb3e26aa65bd)
1*746bf85eSotto #include <iostream>
2*746bf85eSotto 
3*746bf85eSotto 
4*746bf85eSotto class ex {
5*746bf85eSotto };
6*746bf85eSotto 
f(void)7*746bf85eSotto void f(void) {
8*746bf85eSotto 	throw ex();
9*746bf85eSotto }
10*746bf85eSotto 
main()11*746bf85eSotto int main() {
12*746bf85eSotto 	try {
13*746bf85eSotto 		f();
14*746bf85eSotto 	}
15*746bf85eSotto 	catch (const ex & myex) {
16*746bf85eSotto 		std::cout << "Catching..." << std::endl;
17*746bf85eSotto 		exit(0);
18*746bf85eSotto 	}
19*746bf85eSotto 	exit(1);
20*746bf85eSotto }
21