#include <cstdlib>
#include <iostream>
#include <exception>

#define TEST_TERMINATE

void my_terminate()
{
	std::cout << "terminate!" << std::endl;
	std::abort();
}
void my_unexpected()
{
	std::cout << "unexpected!" << std::endl;
	std::abort();
}

void foo() throw(int)
{
	throw "unexpected will be called.";
}

int main()
{
	std::set_terminate(my_terminate);
	std::set_unexpected(my_unexpected);

#ifdef TEST_TERMINATE
    throw 1;
#else
    foo();
#endif
}
