Fix GCC test compiles with exception handling disabled.

This commit is contained in:
jzmaddock
2013-12-18 17:06:08 +00:00
parent 6230db51b1
commit d9cb36d0d3
6 changed files with 49 additions and 24 deletions

View File

@ -476,7 +476,10 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
{
const std::basic_string<charT>& expression = test_info<charT>::expression();
boost::regex_constants::syntax_option_type syntax_options = test_info<charT>::syntax_options();
try{
#ifndef BOOST_NO_EXCEPTIONS
try
#endif
{
r.assign(expression, syntax_options);
if(r.status())
{
@ -494,6 +497,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
//
// Verify sub-expression locations:
//
#ifndef BOOST_NO_EXCEPTIONS
if((syntax_options & boost::regbase::save_subexpression_location) == 0)
{
bool have_except = false;
@ -510,6 +514,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
BOOST_REGEX_TEST_ERROR("Expected std::out_of_range error was not found.", charT);
}
}
#endif
r.assign(expression, syntax_options | boost::regbase::save_subexpression_location);
for(std::size_t i = 0; i < r.mark_count(); ++i)
{
@ -524,6 +529,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
}
}
}
#ifndef BOOST_NO_EXCEPTIONS
catch(const boost::bad_expression& e)
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
@ -540,7 +546,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
{
BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", charT);
}
#endif
}