diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index 57f4c26e..1b7121f0 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -1055,6 +1055,7 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ case syntax_element_jump: case syntax_element_startmark: case syntax_element_backstep: + case syntax_element_toggle_case: // can't legally repeat any of the above: fail(regex_constants::error_badrepeat, m_position - m_base); return false; @@ -3140,7 +3141,13 @@ bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_st m_alt_jumps.pop_back(); this->m_pdata->m_data.align(); re_jump* jmp = static_cast(this->getaddress(jump_offset)); - BOOST_REGEX_ASSERT(jmp->type == syntax_element_jump); + if (jmp->type != syntax_element_jump) + { + // Something really bad happened, this used to be an assert, + // but we'll make it an error just in case we should ever get here. + fail(regex_constants::error_unknown, this->m_position - this->m_base, "Internal logic failed while compiling the expression, probably you added a repeat to something non-repeatable!"); + return false; + } jmp->alt.i = this->m_pdata->m_data.size() - jump_offset; } return true; diff --git a/include/boost/regex/v4/pattern_except.hpp b/include/boost/regex/v4/pattern_except.hpp index 56e83cc9..7aba564b 100644 --- a/include/boost/regex/v4/pattern_except.hpp +++ b/include/boost/regex/v4/pattern_except.hpp @@ -88,7 +88,8 @@ typedef regex_error bad_expression; namespace BOOST_REGEX_DETAIL_NS{ -inline void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex) +template +inline void raise_runtime_error(const E& ex) { #ifndef BOOST_REGEX_STANDALONE ::boost::throw_exception(ex); @@ -101,7 +102,7 @@ template void raise_error(const traits& t, regex_constants::error_type code) { (void)t; // warning suppression - std::runtime_error e(t.error_string(code)); + regex_error e(t.error_string(code), code, 0); ::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(e); } diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index 9b770f15..670efbab 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -1354,6 +1354,7 @@ bool perl_matcher::unwind_alt(bool r) template bool perl_matcher::unwind_repeater_counter(bool) { + ++used_block_count; saved_repeater* pmp = static_cast*>(m_backup_state); boost::BOOST_REGEX_DETAIL_NS::inplace_destroy(pmp++); m_backup_state = pmp;