R6010 - Abort()

I am getting a debug error when my program reaches: throw invalid_argument( "Month must be between 1-12" );

The error is: R6010 - abort() has been called.

1
2
3
4
5
6
7
8
void Date::setMonth( int m )
{
	if ( m > 0 && m <= 12 )
		month = m;
	else 
		throw invalid_argument( "Month must be between 1-12" );
		//cout << "Invalid month";
}


In main:
1
2
3
4
5
	Date date3( 1, 28, 2011 );
	date3.print();
	cout << endl << endl;
	date3.setMonth( 13 );
	date3.print();


Setting the date out of bounds causes this when it should just throw the error message. When I do a try/catch it works properly though.
That's normal. Uncaught exceptions terminate the program, as they should.
Topic archived. No new replies allowed.