PR libstdc++/79206 check string_view sizes in operator==

PR libstdc++/79206
	* include/experimental/string_view (operator==): Check sizes first.
	* include/std/string_view (operator==): Likewise.

From-SVN: r244865
This commit is contained in:
Jonathan Wakely 2017-01-24 12:00:47 +00:00 committed by Jonathan Wakely
parent cf157d80bc
commit 8cb7179d24
3 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2017-01-24 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/79206
* include/experimental/string_view (operator==): Check sizes first.
* include/std/string_view (operator==): Likewise.
2017-01-23 Jonathan Wakely <jwakely@redhat.com>
* testsuite/experimental/array/make_array.cc: Restore <functional>

View file

@ -456,19 +456,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool

View file

@ -453,19 +453,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
inline bool