diff options
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r-- | libstdc++-v3/include/bits/regex.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 6ff9a82..cb6bc93 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -2063,6 +2063,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION = regex_constants::match_default) { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2329. regex_match() with match_results should forbid temporary strings + /// Prevent unsafe attempts to get match_results from a temporary string. + template<typename _Ch_traits, typename _Ch_alloc, + typename _Alloc, typename _Ch_type, typename _Rx_traits> + bool + regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, + match_results<typename basic_string<_Ch_type, + _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, + const basic_regex<_Ch_type, _Rx_traits>&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; + /** * @brief Indicates if there is a match between the regular expression @p e * and a C-style null-terminated string. @@ -2239,6 +2252,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION = regex_constants::match_default) { return regex_search(__s.begin(), __s.end(), __m, __e, __f); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2329. regex_search() with match_results should forbid temporary strings + /// Prevent unsafe attempts to get match_results from a temporary string. + template<typename _Ch_traits, typename _Ch_alloc, + typename _Alloc, typename _Ch_type, + typename _Rx_traits> + bool + regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, + match_results<typename basic_string<_Ch_type, + _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, + const basic_regex<_Ch_type, _Rx_traits>&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; + // std [28.11.4] Function template regex_replace /** * @brief Search for a regular expression within a range for multiple times, @@ -2437,6 +2464,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION *this = regex_iterator(); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2332. regex_iterator should forbid temporary regexes + regex_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; /** * Copy constructs a %regex_iterator. */ @@ -2618,6 +2650,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_subs(__submatches, *(&__submatches+1)), _M_n(0) { _M_init(__a, __b); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2332. regex_token_iterator should forbid temporary regexes + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, int = 0, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + const std::vector<int>&, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + initializer_list<int>, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + template <std::size_t N> + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + const int (&)[N], + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + /** * @brief Copy constructs a %regex_token_iterator. * @param __rhs [IN] A %regex_token_iterator to copy. |