+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>
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
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