www.digitalmars.com         C & C++   DMDScript  

c++ - Exception specifications

Hi,

#include <iostream>
void test() throw (int);
int main()
{
	test();
	std::cout << "Completed successfully" << std::endl;
}
void test() throw (int)
{
	try
	{
		throw 'a';
	}
	catch (char const&)
	{
		std::cout << "Caught char" << std::endl;
	}
}

When built with DM and run, the test function never completes.
The throw (int) exception specification should prevent any exception of 
type different from int to be thrown out of the function, but it appears 
DM does not allow throwing of such exceptions altogether (even though 
they are handled within the function and not thrown out).

Regards,
Dimitri
Mar 06 2004