PR libstdc++/83600 fix end iterator for unready std::match_results
PR libstdc++/83600 * include/bits/regex.h (match_results::end()): Return valid iterator when not ready. * testsuite/28_regex/match_results/ctors/char/default.cc: Check that unready objects are empty and have equal begin and end iterators. * testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise. From-SVN: r256014
This commit is contained in:
parent
8afe2df012
commit
ecba356686
@ -1,5 +1,12 @@
|
|||||||
2017-12-27 Jonathan Wakely <jwakely@redhat.com>
|
2017-12-27 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/83600
|
||||||
|
* include/bits/regex.h (match_results::end()): Return valid iterator
|
||||||
|
when not ready.
|
||||||
|
* testsuite/28_regex/match_results/ctors/char/default.cc: Check that
|
||||||
|
unready objects are empty and have equal begin and end iterators.
|
||||||
|
* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.
|
||||||
|
|
||||||
PR libstdc++/83598
|
PR libstdc++/83598
|
||||||
* include/bits/regex.h (basic_regex): Don't modify flags passed to
|
* include/bits/regex.h (basic_regex): Don't modify flags passed to
|
||||||
constructors.
|
constructors.
|
||||||
|
@ -1749,7 +1749,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
|
|||||||
*/
|
*/
|
||||||
const_iterator
|
const_iterator
|
||||||
end() const
|
end() const
|
||||||
{ return _Base_type::end() - 3; }
|
{ return _Base_type::end() - (empty() ? 0 : 3); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets an iterator to one-past-the-end of the collection.
|
* @brief Gets an iterator to one-past-the-end of the collection.
|
||||||
|
@ -30,6 +30,8 @@ void test01()
|
|||||||
std::cmatch cm;
|
std::cmatch cm;
|
||||||
VERIFY( cm.size() == 0 );
|
VERIFY( cm.size() == 0 );
|
||||||
VERIFY( !cm.ready() );
|
VERIFY( !cm.ready() );
|
||||||
|
VERIFY( cm.empty() );
|
||||||
|
VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
|
||||||
}
|
}
|
||||||
|
|
||||||
void test02()
|
void test02()
|
||||||
@ -37,6 +39,8 @@ void test02()
|
|||||||
std::smatch sm;
|
std::smatch sm;
|
||||||
VERIFY( sm.size() == 0 );
|
VERIFY( sm.size() == 0 );
|
||||||
VERIFY( !sm.ready() );
|
VERIFY( !sm.ready() );
|
||||||
|
VERIFY( sm.empty() );
|
||||||
|
VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -30,6 +30,8 @@ void test01()
|
|||||||
std::wcmatch cm;
|
std::wcmatch cm;
|
||||||
VERIFY( cm.size() == 0 );
|
VERIFY( cm.size() == 0 );
|
||||||
VERIFY( !cm.ready() );
|
VERIFY( !cm.ready() );
|
||||||
|
VERIFY( cm.empty() );
|
||||||
|
VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
|
||||||
}
|
}
|
||||||
|
|
||||||
void test02()
|
void test02()
|
||||||
@ -37,6 +39,8 @@ void test02()
|
|||||||
std::wsmatch sm;
|
std::wsmatch sm;
|
||||||
VERIFY( sm.size() == 0 );
|
VERIFY( sm.size() == 0 );
|
||||||
VERIFY( !sm.ready() );
|
VERIFY( !sm.ready() );
|
||||||
|
VERIFY( sm.empty() );
|
||||||
|
VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user