diff mbox series

PR libstdc++/70483 make std::string_view fully constexpr

Message ID 20170911214846.GA8159@redhat.com
State New
Headers show
Series PR libstdc++/70483 make std::string_view fully constexpr | expand

Commit Message

Jonathan Wakely Sept. 11, 2017, 9:48 p.m. UTC
This adds 'constexpr' everywhere it's missing from
std::basic_string_view.

	PR libstdc++/70483
	* include/bits/string_view.tcc (basic_string_view::find)
	(basic_string_view::rfind, basic_string_view::find_first_of)
	(basic_string_view::find_last_of, basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of): Add constexpr specifier.
	* include/std/string_view (basic_string_view::operator=)
	(basic_string_view::rbegin, basic_string_view::rend)
	(basic_string_view::crbegin, basic_string_view::crend)
	(basic_string_view::remove_prefix, basic_string_view::remove_suffix)
	(basic_string_view::swap, basic_string_view::compare)
	(basic_string_view::find, basic_string_view::rfind)
	(basic_string_view::find_first_of, basic_string_view::find_last_of)
	(basic_string_view::find_first_not_of)
	(basic_string_view::find_last_not_of, basic_string_view::_M_check)
	(basic_string_view::_M_limit, operator==, operator!=, operator<)
	(operator>, operator<=, operator>=): Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	char/1.cc: Repeat tests in constexpr context.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/char/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/range_access/char/1.cc: Test
	cbegin, cend, rbegin, rend, crbegin and crend.
	* testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
	Remove trailing whitespace.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
	1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	New.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	New.
	* testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
	New.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
	2.cc: New.

Tested powerpc64le-linux, committed to trunk.
commit 280c8e2870fc50a27a174a1b0fdb9d2a4d0a8d28
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Sep 11 22:03:23 2017 +0100

    PR libstdc++/70483 make std::string_view fully constexpr
    
            PR libstdc++/70483
            * include/bits/string_view.tcc (basic_string_view::find)
            (basic_string_view::rfind, basic_string_view::find_first_of)
            (basic_string_view::find_last_of, basic_string_view::find_first_not_of)
            (basic_string_view::find_last_not_of): Add constexpr specifier.
            * include/std/string_view (basic_string_view::operator=)
            (basic_string_view::rbegin, basic_string_view::rend)
            (basic_string_view::crbegin, basic_string_view::crend)
            (basic_string_view::remove_prefix, basic_string_view::remove_suffix)
            (basic_string_view::swap, basic_string_view::compare)
            (basic_string_view::find, basic_string_view::rfind)
            (basic_string_view::find_first_of, basic_string_view::find_last_of)
            (basic_string_view::find_first_not_of)
            (basic_string_view::find_last_not_of, basic_string_view::_M_check)
            (basic_string_view::_M_limit, operator==, operator!=, operator<)
            (operator>, operator<=, operator>=): Likewise.
            * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
            char/1.cc: Repeat tests in constexpr context.
            * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
            wchar_t/1.cc: Likewise.
            * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
            char/1.cc: Likewise.
            * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
            wchar_t/1.cc: Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/char/1.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/char/2.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/char/3.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operators/char/2.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Test
            cbegin, cend, rbegin, rend, crbegin and crend.
            * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
            Likewise.
            * testsuite/21_strings/basic_string_view/operations/compare/char/1.cc:
            Remove trailing whitespace.
            * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
            1.cc: Likewise.
            * testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
            New.
            * testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
            New.
            * testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
            New.
            * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/
            2.cc: New.

Comments

Jonathan Wakely Sept. 12, 2017, 1:31 p.m. UTC | #1
On 11/09/17 22:48 +0100, Jonathan Wakely wrote:
>This adds 'constexpr' everywhere it's missing from
>std::basic_string_view.

And this does it for std::experimental::basic_string_view, fixing the
bug as reported.

Tested powerpc64le-linux, committed to trunk.
commit d1cb3e5ac0bf7b07a06d4b8bbdd4f6752be112ae
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Sep 12 10:44:38 2017 +0100

    PR libstdc++/70483 make std::experimental::string_view fully constexpr
    
            PR libstdc++/70483
            * include/experimental/bits/string_view.tcc (basic_string_view::find)
            (basic_string_view::rfind, basic_string_view::find_first_of)
            (basic_string_view::find_last_of, basic_string_view::find_first_not_of)
            (basic_string_view::find_last_not_of): Add constexpr specifier.
            * include/experimental/string_view (basic_string_view::remove_prefix)
            (basic_string_view::remove_suffix, basic_string_view::swap)
            (basic_string_view::compare, basic_string_view::find)
            (basic_string_view::rfind, basic_string_view::find_first_of)
            (basic_string_view::find_last_of, basic_string_view::find_first_not_of)
            (basic_string_view::find_last_not_of, operator==, operator!=)
            (operator<, operator>, operator<=, operator>=): Likewise.
            * testsuite/experimental/string_view/operations/compare/char/70483.cc:
            New.

diff --git a/libstdc++-v3/include/experimental/bits/string_view.tcc b/libstdc++-v3/include/experimental/bits/string_view.tcc
index e66932d1ac0..450a43c7876 100644
--- a/libstdc++-v3/include/experimental/bits/string_view.tcc
+++ b/libstdc++-v3/include/experimental/bits/string_view.tcc
@@ -49,7 +49,7 @@ namespace experimental
 inline namespace fundamentals_v1
 {
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
     {
@@ -70,7 +70,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find(_CharT __c, size_type __pos) const noexcept
     {
@@ -86,7 +86,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
     {
@@ -106,7 +106,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     rfind(_CharT __c, size_type __pos) const noexcept
     {
@@ -123,7 +123,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -139,7 +139,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -160,7 +160,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -172,7 +172,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_not_of(_CharT __c, size_type __pos) const noexcept
     {
@@ -183,7 +183,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -204,7 +204,7 @@ inline namespace fundamentals_v1
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_not_of(_CharT __c, size_type __pos) const noexcept
     {
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 5cec5597744..2e8e7cda62d 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -219,7 +219,7 @@ inline namespace fundamentals_v1
 
       // [string.view.modifiers], modifiers:
 
-      void
+      constexpr void
       remove_prefix(size_type __n)
       {
 	__glibcxx_assert(this->_M_len >= __n);
@@ -227,15 +227,16 @@ inline namespace fundamentals_v1
 	this->_M_len -= __n;
       }
 
-      void
+      constexpr void
       remove_suffix(size_type __n)
       { this->_M_len -= __n; }
 
-      void
+      constexpr void
       swap(basic_string_view& __sv) noexcept
       {
-	std::swap(this->_M_len, __sv._M_len);
-	std::swap(this->_M_str, __sv._M_str);
+	auto __tmp = *this;
+	*this = __sv;
+	__sv = __tmp;
       }
 
 
@@ -285,7 +286,7 @@ inline namespace fundamentals_v1
 				     __pos, this->size()), basic_string_view{});
       }
 
-      int
+      constexpr int
       compare(basic_string_view __str) const noexcept
       {
 	int __ret = traits_type::compare(this->_M_str, __str._M_str,
@@ -295,24 +296,24 @@ inline namespace fundamentals_v1
 	return __ret;
       }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1, basic_string_view __str) const
       { return this->substr(__pos1, __n1).compare(__str); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1,
 	      basic_string_view __str, size_type __pos2, size_type __n2) const
       { return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); }
 
-      int
+      constexpr int
       compare(const _CharT* __str) const noexcept
       { return this->compare(basic_string_view{__str}); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1, const _CharT* __str) const
       { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1,
 	      const _CharT* __str, size_type __n2) const
       {
@@ -320,97 +321,97 @@ inline namespace fundamentals_v1
 		   .compare(basic_string_view(__str, __n2));
       }
 
-      size_type
+      constexpr size_type
       find(basic_string_view __str, size_type __pos = 0) const noexcept
       { return this->find(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find(_CharT __c, size_type __pos=0) const noexcept;
 
-      size_type
+      constexpr size_type
       find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
 
-      size_type
+      constexpr size_type
       find(const _CharT* __str, size_type __pos=0) const noexcept
       { return this->find(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       rfind(basic_string_view __str, size_type __pos = npos) const noexcept
       { return this->rfind(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       rfind(_CharT __c, size_type __pos = npos) const noexcept;
 
-      size_type
+      constexpr size_type
       rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
 
-      size_type
+      constexpr size_type
       rfind(const _CharT* __str, size_type __pos = npos) const noexcept
       { return this->rfind(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
       { return this->find_first_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_first_of(_CharT __c, size_type __pos = 0) const noexcept
       { return this->find(__c, __pos); }
 
-      size_type
+      constexpr size_type
       find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
       { return this->find_first_of(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_last_of(basic_string_view __str,
 		   size_type __pos = npos) const noexcept
       { return this->find_last_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_last_of(_CharT __c, size_type __pos=npos) const noexcept
       { return this->rfind(__c, __pos); }
 
-      size_type
+      constexpr size_type
       find_last_of(const _CharT* __str, size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
       { return this->find_last_of(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_first_not_of(basic_string_view __str,
 			size_type __pos = 0) const noexcept
       { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
 
-      size_type
+      constexpr size_type
       find_first_not_of(const _CharT* __str,
 			size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
       {
 	return this->find_first_not_of(__str, __pos,
 				       traits_type::length(__str));
       }
 
-      size_type
+      constexpr size_type
       find_last_not_of(basic_string_view __str,
 		       size_type __pos = npos) const noexcept
       { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
 
-      size_type
+      constexpr size_type
       find_last_not_of(const _CharT* __str,
 		       size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_last_not_of(const _CharT* __str,
 		       size_type __pos = npos) const noexcept
       {
@@ -446,109 +447,109 @@ inline namespace fundamentals_v1
   }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
diff --git a/libstdc++-v3/testsuite/experimental/string_view/operations/compare/char/70483.cc b/libstdc++-v3/testsuite/experimental/string_view/operations/compare/char/70483.cc
new file mode 100644
index 00000000000..3bfb59c046b
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/string_view/operations/compare/char/70483.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++14 } }
+
+#include <experimental/string_view>
+
+struct constexpr_char_traits : std::char_traits<char>
+{
+  static constexpr size_t
+  length(const char* val)
+  {
+    size_t res = 0;
+    for (; val[res] != '\0'; ++res)
+      ;
+    return res;
+  }
+
+  static constexpr int
+  compare(const char* lhs, const char* rhs, std::size_t count)
+  {
+    for (size_t pos = 0; pos < count; ++pos)
+    {
+      if (lhs[pos] != rhs[pos])
+        return lhs[pos] - rhs[pos];
+    }
+    return 0;
+  }
+
+  static constexpr const char*
+  find(const char* p, std::size_t n, char c)
+  {
+    for (size_t pos = 0; pos < n; ++pos)
+      if (p[pos] == c)
+	return p + pos;
+    return nullptr;
+  }
+};
+
+using string_view
+  = std::experimental::basic_string_view<char, constexpr_char_traits>;
+
+constexpr
+string_view get()
+{
+    string_view res = "x::";
+    string_view start_pattern = "x";
+    res = res.substr(res.find(start_pattern) + start_pattern.size());
+    res = res.substr(0, res.find_first_of(";]"));
+    res = res.substr(res.rfind("::"));
+    return res;
+}
+
+static_assert( get() == get() );
diff mbox series

Patch

diff --git a/libstdc++-v3/include/bits/string_view.tcc b/libstdc++-v3/include/bits/string_view.tcc
index f4bd50fd4a0..b8ab78cedf1 100644
--- a/libstdc++-v3/include/bits/string_view.tcc
+++ b/libstdc++-v3/include/bits/string_view.tcc
@@ -45,7 +45,7 @@  namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
     {
@@ -66,7 +66,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find(_CharT __c, size_type __pos) const noexcept
     {
@@ -82,7 +82,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept
     {
@@ -102,7 +102,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     rfind(_CharT __c, size_type __pos) const noexcept
     {
@@ -119,7 +119,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -135,7 +135,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -156,7 +156,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_not_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -168,7 +168,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_first_not_of(_CharT __c, size_type __pos) const noexcept
     {
@@ -179,7 +179,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_not_of(const _CharT* __str, size_type __pos, size_type __n) const
     {
@@ -200,7 +200,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   template<typename _CharT, typename _Traits>
-    typename basic_string_view<_CharT, _Traits>::size_type
+    constexpr typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find_last_not_of(_CharT __c, size_type __pos) const noexcept
     {
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 88a7686618c..d766b75f9a7 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -106,7 +106,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
         _M_str{__str}
       { }
 
-      basic_string_view&
+      constexpr basic_string_view&
       operator=(const basic_string_view&) noexcept = default;
 
       // [string.view.iterators], iterators
@@ -127,19 +127,19 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       cend() const noexcept
       { return this->_M_str + this->_M_len; }
 
-      const_reverse_iterator
+      constexpr const_reverse_iterator
       rbegin() const noexcept
       { return const_reverse_iterator(this->end()); }
 
-      const_reverse_iterator
+      constexpr const_reverse_iterator
       rend() const noexcept
       { return const_reverse_iterator(this->begin()); }
 
-      const_reverse_iterator
+      constexpr const_reverse_iterator
       crbegin() const noexcept
       { return const_reverse_iterator(this->end()); }
 
-      const_reverse_iterator
+      constexpr const_reverse_iterator
       crend() const noexcept
       { return const_reverse_iterator(this->begin()); }
 
@@ -208,7 +208,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       // [string.view.modifiers], modifiers:
 
-      void
+      constexpr void
       remove_prefix(size_type __n)
       {
 	__glibcxx_assert(this->_M_len >= __n);
@@ -216,15 +216,16 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	this->_M_len -= __n;
       }
 
-      void
+      constexpr void
       remove_suffix(size_type __n)
       { this->_M_len -= __n; }
 
-      void
+      constexpr void
       swap(basic_string_view& __sv) noexcept
       {
-	std::swap(this->_M_len, __sv._M_len);
-	std::swap(this->_M_str, __sv._M_str);
+	auto __tmp = *this;
+	*this = __sv;
+	__sv = __tmp;
       }
 
 
@@ -261,7 +262,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 				     __pos, this->size()), basic_string_view{});
       }
 
-      int
+      constexpr int
       compare(basic_string_view __str) const noexcept
       {
 	int __ret = traits_type::compare(this->_M_str, __str._M_str,
@@ -271,24 +272,24 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	return __ret;
       }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1, basic_string_view __str) const
       { return this->substr(__pos1, __n1).compare(__str); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1,
 	      basic_string_view __str, size_type __pos2, size_type __n2) const
       { return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); }
 
-      int
+      constexpr int
       compare(const _CharT* __str) const noexcept
       { return this->compare(basic_string_view{__str}); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1, const _CharT* __str) const
       { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
 
-      int
+      constexpr int
       compare(size_type __pos1, size_type __n1,
 	      const _CharT* __str, size_type __n2) const
       {
@@ -296,97 +297,97 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		   .compare(basic_string_view(__str, __n2));
       }
 
-      size_type
+      constexpr size_type
       find(basic_string_view __str, size_type __pos = 0) const noexcept
       { return this->find(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find(_CharT __c, size_type __pos=0) const noexcept;
 
-      size_type
+      constexpr size_type
       find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
 
-      size_type
+      constexpr size_type
       find(const _CharT* __str, size_type __pos=0) const noexcept
       { return this->find(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       rfind(basic_string_view __str, size_type __pos = npos) const noexcept
       { return this->rfind(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       rfind(_CharT __c, size_type __pos = npos) const noexcept;
 
-      size_type
+      constexpr size_type
       rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
 
-      size_type
+      constexpr size_type
       rfind(const _CharT* __str, size_type __pos = npos) const noexcept
       { return this->rfind(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
       { return this->find_first_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_first_of(_CharT __c, size_type __pos = 0) const noexcept
       { return this->find(__c, __pos); }
 
-      size_type
+      constexpr size_type
       find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
       { return this->find_first_of(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_last_of(basic_string_view __str,
 		   size_type __pos = npos) const noexcept
       { return this->find_last_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_last_of(_CharT __c, size_type __pos=npos) const noexcept
       { return this->rfind(__c, __pos); }
 
-      size_type
+      constexpr size_type
       find_last_of(const _CharT* __str, size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
       { return this->find_last_of(__str, __pos, traits_type::length(__str)); }
 
-      size_type
+      constexpr size_type
       find_first_not_of(basic_string_view __str,
 			size_type __pos = 0) const noexcept
       { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
 
-      size_type
+      constexpr size_type
       find_first_not_of(const _CharT* __str,
 			size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
       {
 	return this->find_first_not_of(__str, __pos,
 				       traits_type::length(__str));
       }
 
-      size_type
+      constexpr size_type
       find_last_not_of(basic_string_view __str,
 		       size_type __pos = npos) const noexcept
       { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
 
-      size_type
+      constexpr size_type
       find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
 
-      size_type
+      constexpr size_type
       find_last_not_of(const _CharT* __str,
 		       size_type __pos, size_type __n) const;
 
-      size_type
+      constexpr size_type
       find_last_not_of(const _CharT* __str,
 		       size_type __pos = npos) const noexcept
       {
@@ -394,7 +395,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 				      traits_type::length(__str));
       }
 
-      size_type
+      constexpr size_type
       _M_check(size_type __pos, const char* __s) const
       {
 	if (__pos > this->size())
@@ -405,7 +406,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
       // NB: _M_limit doesn't check for a bad __pos value.
-      size_type
+      constexpr size_type
       _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT
       {
 	const bool __testoff =  __off < this->size() - __pos;
@@ -440,109 +441,109 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.size() == __y.size() && __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    inline bool
+    constexpr bool
     operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc
index da5558da91f..2ce3824d260 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc
@@ -33,10 +33,29 @@  test01()
   VERIFY( str0 == string_view{"pus mons"} );
 }
 
+constexpr bool
+test02()
+{
+  using std::string_view;
+
+  string_view str0{"olympus mons"};
+  string_view::pointer p = str0.data();
+  str0.remove_prefix(4);
+  if ( str0.data() != p + 4)
+    return false;
+  if ( str0.length() != 8 )
+    return false;
+  if ( str0 != string_view{"pus mons"} )
+    return false;
+
+  return true;
+}
+
 int
 main()
 { 
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc
index db38ab3c616..5c74837dde5 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc
@@ -33,10 +33,29 @@  test01()
   VERIFY( str0 == wstring_view{L"pus mons"} );
 }
 
+constexpr bool
+test02()
+{
+  using std::wstring_view;
+
+  wstring_view str0{L"olympus mons"};
+  wstring_view::pointer p = str0.data();
+  str0.remove_prefix(4);
+  if ( str0.data() != p + 4)
+    return false;
+  if ( str0.length() != 8 )
+    return false;
+  if ( str0 != wstring_view{L"pus mons"} )
+    return false;
+
+  return true;
+}
+
 int
 main()
 { 
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc
index 042f9bbce6b..4014fc590e2 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc
@@ -33,10 +33,29 @@  test01()
   VERIFY( str0 == string_view{"olympus mo"} );
 }
 
+constexpr bool
+test02()
+{
+  using std::string_view;
+
+  string_view str0{"olympus mons"};
+  string_view::pointer p = str0.data();
+  str0.remove_suffix(2);
+  if ( str0.data() != p)
+    return false;
+  if ( str0.length() != 10 )
+    return false;
+  if ( str0 != string_view{"olympus mo"} )
+    return false;
+
+  return true;
+}
+
 int
 main()
 { 
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc
index 05c90d8c32a..f0423bc01aa 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc
@@ -33,10 +33,29 @@  test01()
   VERIFY( str0 == wstring_view{L"olympus mo"} );
 }
 
+constexpr bool
+test02()
+{
+  using std::wstring_view;
+
+  wstring_view str0{L"olympus mons"};
+  wstring_view::pointer p = str0.data();
+  str0.remove_suffix(2);
+  if ( str0.data() != p)
+    return false;
+  if ( str0.length() != 10 )
+    return false;
+  if ( str0 != wstring_view{L"olympus mo"} )
+    return false;
+
+  return true;
+}
+
 int
 main()
 { 
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc
new file mode 100644
index 00000000000..0cb4c79861b
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc
@@ -0,0 +1,35 @@ 
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <string_view>
+
+constexpr bool
+test01()
+{
+  using std::string_view;
+
+  string_view s1{"last"};
+  string_view s2{"first"};
+
+  s1.swap(s2);
+  return s1 == "first" && s2 == "last";
+}
+
+static_assert( test01() );
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc
new file mode 100644
index 00000000000..d8322a8b274
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc
@@ -0,0 +1,35 @@ 
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <string_view>
+
+constexpr bool
+test01()
+{
+  using std::wstring_view;
+
+  wstring_view s1{L"last"};
+  wstring_view s2{L"first"};
+
+  s1.swap(s2);
+  return s1 == L"first" && s2 == L"last";
+}
+
+static_assert( test01() );
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/1.cc
index e4e41f70a47..26e51b88a4e 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/1.cc
@@ -62,9 +62,8 @@  test_value(int result, want_value expected)
   VERIFY(pass);
   return 0;
 }
- 
 
-int 
+int
 test01()
 {
   using std::string_view;
@@ -74,7 +73,7 @@  test01()
   string_view 	str_2;
 
   //sanity check
-  test_value(strcmp("costa marbella", "costa rica"), lt); 
+  test_value(strcmp("costa marbella", "costa rica"), lt);
   test_value(strcmp("costa rica", "costa rica"), z);
   test_value(strcmp(str_1.data(), str_0.data()), lt);
   test_value(strcmp(str_0.data(), str_1.data()), gt);
@@ -100,8 +99,8 @@  test01()
   test_value(str_1.compare(0, 4, str_2), z);
   test_value(str_1.compare(0, 5, str_2), gt);
 
-  // int compare(size_type pos1, size_type n1, const basic_string_view& str, 
-  //		 size_type pos2, size_type n2) const;	
+  // int compare(size_type pos1, size_type n1, const basic_string_view& str,
+  //		 size_type pos2, size_type n2) const;
   test_value(str_1.compare(0, 6, str_0, 0, 6), z);
   test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
   test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
@@ -111,21 +110,21 @@  test01()
   test_value(str_1.compare("costa rica"), lt);
   str_2 = str_0;
   test_value(str_2.compare("costa rica"), z);
-  test_value(str_2.compare("cost"), gt);			
-  test_value(str_2.compare("costa ricans"), lt);	   
+  test_value(str_2.compare("cost"), gt);
+  test_value(str_2.compare("costa ricans"), lt);
 
   // int compare(size_type pos, size_type n1, const charT* str,
   //             size_type n2 = npos) const;
-  test_value(str_1.compare(0, 6, "costa rica", 0, 6), z); 
-  test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt); 
-  test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt); 
+  test_value(str_1.compare(0, 6, "costa rica", 0, 6), z);
+  test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt);
+  test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt);
 
   return 0;
 }
 
 
-int 
-main() 
+int
+main()
 {
   test01();
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/2.cc
new file mode 100644
index 00000000000..8118b97468b
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/2.cc
@@ -0,0 +1,30 @@ 
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <string_view>
+
+constexpr char c1[] = "one";
+constexpr char c2[] = "two";
+
+constexpr std::string_view s1{c1};
+constexpr std::string_view s2{c2};
+
+constexpr int n1 = s1.compare(s1);
+constexpr int n2 = s1.compare(s2);
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc
new file mode 100644
index 00000000000..27b6def1b05
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc
@@ -0,0 +1,89 @@ 
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <string_view>
+
+struct constexpr_char_traits : std::char_traits<char>
+{
+  static constexpr size_t
+  length(const char* val)
+  {
+    size_t res = 0;
+    for (; val[res] != '\0'; ++res)
+      ;
+    return res;
+  }
+
+  static constexpr int
+  compare(const char* lhs, const char* rhs, std::size_t count)
+  {
+    for (size_t pos = 0; pos < count; ++pos)
+    {
+      if (lhs[pos] != rhs[pos])
+        return lhs[pos] - rhs[pos];
+    }
+    return 0;
+  }
+};
+
+using string_view = std::basic_string_view<char, constexpr_char_traits>;
+
+constexpr
+string_view get()
+{
+    string_view res = "x::";
+    string_view start_pattern = "x";
+    res = res.substr(res.find(start_pattern) + start_pattern.size());
+    res = res.substr(0, res.find_first_of(";]"));
+    res = res.substr(res.rfind("::"));
+    return res;
+}
+
+static_assert( get() == get() );
+
+using std::u16string_view;
+
+constexpr
+u16string_view get16()
+{
+    u16string_view res = u"x::";
+    u16string_view start_pattern = u"x";
+    res = res.substr(res.find(start_pattern) + start_pattern.size());
+    res = res.substr(0, res.find_first_of(u";]"));
+    res = res.substr(res.rfind(u"::"));
+    return res;
+}
+
+static_assert( get16() == get16() );
+
+using std::u32string_view;
+
+constexpr
+u32string_view get32()
+{
+    u32string_view res = U"x::";
+    u32string_view start_pattern = U"x";
+    res = res.substr(res.find(start_pattern) + start_pattern.size());
+    res = res.substr(0, res.find_first_of(U";]"));
+    res = res.substr(res.rfind(U"::"));
+    return res;
+}
+
+static_assert( get32() == get32() );
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc
index 47b36c6cb01..60f5bcf0e36 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc
@@ -62,9 +62,9 @@  test_value(int result, want_value expected)
   VERIFY(pass);
   return 0;
 }
- 
 
-int 
+
+int
 test01()
 {
   using std::wstring_view;
@@ -74,7 +74,7 @@  test01()
   wstring_view 	str_2;
 
   //sanity check
-  test_value(wcscmp(L"costa marbella", L"costa rica"), lt); 
+  test_value(wcscmp(L"costa marbella", L"costa rica"), lt);
   test_value(wcscmp(L"costa rica", L"costa rica"), z);
   test_value(wcscmp(str_1.data(), str_0.data()), lt);
   test_value(wcscmp(str_0.data(), str_1.data()), gt);
@@ -100,8 +100,8 @@  test01()
   test_value(str_1.compare(0, 4, str_2), z);
   test_value(str_1.compare(0, 5, str_2), gt);
 
-  // int compare(size_type pos1, size_type n1, const basic_string_view& str, 
-  //		 size_type pos2, size_type n2) const;	
+  // int compare(size_type pos1, size_type n1, const basic_string_view& str,
+  //		 size_type pos2, size_type n2) const;
   test_value(str_1.compare(0, 6, str_0, 0, 6), z);
   test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
   test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
@@ -111,21 +111,21 @@  test01()
   test_value(str_1.compare(L"costa rica"), lt);
   str_2 = str_0;
   test_value(str_2.compare(L"costa rica"), z);
-  test_value(str_2.compare(L"cost"), gt);			
-  test_value(str_2.compare(L"costa ricans"), lt);	   
+  test_value(str_2.compare(L"cost"), gt);
+  test_value(str_2.compare(L"costa ricans"), lt);
 
   // int compare(size_type pos, size_type n1, const charT* str,
   //             size_type n2 = npos) const;
-  test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z); 
-  test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt); 
-  test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt); 
+  test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z);
+  test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt);
+  test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt);
 
   return 0;
 }
 
 
-int 
-main() 
+int
+main()
 {
   test01();
 
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc
new file mode 100644
index 00000000000..0049ae3ca0c
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc
@@ -0,0 +1,30 @@ 
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <string_view>
+
+constexpr wchar_t c1[] = L"one";
+constexpr wchar_t c2[] = L"two";
+
+constexpr std::wstring_view s1{c1};
+constexpr std::wstring_view s2{c2};
+
+constexpr int n1 = s1.compare(s1);
+constexpr int n2 = s1.compare(s2);
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/1.cc
index cc56ddba91e..d00bcdf1459 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/1.cc
@@ -61,10 +61,10 @@  test01()
   csz01 = str01.find(str04, 5);
   VERIFY( csz01 == 5 );
   csz01 = str01.find(str04, str01.size());
-  VERIFY( csz01 == str01.size() ); 
+  VERIFY( csz01 == str01.size() );
   csz01 = str01.find(str04, str01.size()+1);
-  VERIFY( csz01 == npos ); 
-  
+  VERIFY( csz01 == npos );
+
   // size_type find(const char* s, size_type pos, size_type n) const;
   csz01 = str01.find(str_lit01, 0, 3);
   VERIFY( csz01 == 0 );
@@ -85,10 +85,80 @@  test01()
   VERIFY( csz01 == npos );
 }
 
+constexpr bool
+test02()
+{
+  typedef std::string_view::size_type csize_type;
+  typedef std::string_view::const_reference cref;
+  typedef std::string_view::reference ref;
+  csize_type npos = std::string_view::npos;
+  csize_type csz01 = 0, csz02 = 0;
+
+  const char str_lit01[] = "mave";
+  const std::string_view str01("mavericks, santa cruz");
+  std::string_view str02(str_lit01);
+  std::string_view str03("s, s");
+  std::string_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find(const string_view&, size_type pos = 0) const;
+  csz01 = str01.find(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str01, 4);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str02, 3);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 12);
+  VERIFY( csz01 == npos );
+
+  // An empty string_view consists of no characters
+  // therefore it should be found at every point in a string_view,
+  // except beyond the end
+  csz01 = str01.find(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str04, 5);
+  VERIFY( csz01 == 5 );
+  csz01 = str01.find(str04, str01.size());
+  VERIFY( csz01 == str01.size() );
+  csz01 = str01.find(str04, str01.size()+1);
+  VERIFY( csz01 == npos );
+
+  // size_type find(const char* s, size_type pos, size_type n) const;
+  csz01 = str01.find(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3, 0);
+  VERIFY( csz01 == 3 );
+
+  // size_type find(const char* s, size_type pos = 0) const;
+  csz01 = str01.find(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3);
+  VERIFY( csz01 == npos );
+
+  // size_type find(char c, size_type pos = 0) const;
+  csz01 = str01.find('z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+  csz01 = str01.find('/');
+  VERIFY( csz01 == npos );
+
+  return true;
+}
+
+
 int
 main()
-{ 
+{
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/2.cc
index 2420cb98073..59fa0766a22 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/2.cc
@@ -59,13 +59,13 @@  test02()
   // An empty string_view consists of no characters
   // therefore it should be found at every point in a string_view,
   // except beyond the end
-  // However, str1.find_first_of(str2,pos) finds the first character in 
+  // However, str1.find_first_of(str2,pos) finds the first character in
   // str1 (starting at pos) that exists in str2, which is none for empty str2
   csz01 = str01.find_first_of(str04, 0);
   VERIFY( csz01 == npos );
   csz01 = str01.find_first_of(str04, 5);
   VERIFY( csz01 == npos );
-  
+
   // size_type find_first_of(const char* s, size_type pos, size_type n) const;
   csz01 = str01.find_first_of(str_lit01, 0, 3);
   VERIFY( csz01 == 0 );
@@ -84,10 +84,78 @@  test02()
   VERIFY( csz01 == csz02 );
 }
 
+constexpr bool
+test03()
+{
+  typedef std::string_view::size_type csize_type;
+  csize_type npos = std::string_view::npos;
+  csize_type csz01 = 0, csz02 = 0;
+
+  const char str_lit01[] = "mave";
+  const std::string_view str01("mavericks, santa cruz");
+  std::string_view str02(str_lit01);
+  std::string_view str03("s, s");
+  std::string_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find_first_of(const string_view&, size_type pos = 0) const;
+  std::string_view str05("xena rulez");
+  csz01 = str01.find_first_of(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str01, 4);
+  VERIFY( csz01 == 4 );
+  csz01 = str01.find_first_of(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str02, 3);
+  VERIFY( csz01 == 3 );
+  csz01 = str01.find_first_of(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 12);
+  VERIFY( csz01 == 16 );
+  csz01 = str01.find_first_of(str05, 0);
+  VERIFY( csz01 == 1 );
+  csz01 = str01.find_first_of(str05, 4);
+  VERIFY( csz01 == 4 );
+
+  // An empty string_view consists of no characters
+  // therefore it should be found at every point in a string_view,
+  // except beyond the end
+  // However, str1.find_first_of(str2,pos) finds the first character in
+  // str1 (starting at pos) that exists in str2, which is none for empty str2
+  csz01 = str01.find_first_of(str04, 0);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_of(str04, 5);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_of(const char* s, size_type pos, size_type n) const;
+  csz01 = str01.find_first_of(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3, 0);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_of(const char* s, size_type pos = 0) const;
+  csz01 = str01.find_first_of(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3);
+  VERIFY( csz01 == 3 );
+
+  // size_type find_first_of(char c, size_type pos = 0) const;
+  csz01 = str01.find_first_of('z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+
+  return true;
+}
+
 int
 main()
-{ 
+{
   test02();
+  static_assert( test03() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/3.cc
index 9c9a49123f8..edbe8df1c65 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/3.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/char/3.cc
@@ -84,10 +84,78 @@  test03()
   VERIFY( csz01 == npos );
 }
 
+constexpr bool
+test04()
+{
+  typedef std::string_view::size_type csize_type;
+  csize_type npos = std::string_view::npos;
+  csize_type csz01 = 0;
+
+  const std::string_view str01("Bob Rock, per me");
+  const char str_lit01[] = "Bob Rock";
+  std::string_view str02("ovvero Trivi");
+  std::string_view str03(str_lit01);
+  std::string_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find_first_not_of(const string_view&, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of(str01);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_not_of(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str02, 10);
+  VERIFY( csz01 == 10 );
+  csz01 = str01.find_first_not_of(str02, 12);
+  VERIFY( csz01 == 14 );
+  csz01 = str01.find_first_not_of(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_not_of(str03, 15);
+  VERIFY( csz01 == 15 );
+  csz01 = str01.find_first_not_of(str03, 16);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_not_of(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str04, 12);
+  VERIFY( csz01 == 12 );
+  csz01 = str03.find_first_not_of(str01, 0);
+  VERIFY( csz01 == npos );
+  csz01 = str04.find_first_not_of(str02, 0);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
+  csz01 = str01.find_first_not_of(str_lit01, 0, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str_lit01, 0, 8);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_not_of(str_lit01, 10, 0);
+  VERIFY( csz01 == 10 );
+
+  // size_type find_first_not_of(const char* s, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of(str_lit01);
+  VERIFY( csz01 == 8 );
+  csz01 = str02.find_first_not_of(str_lit01, 2);
+  VERIFY( csz01 == 2 );
+
+  // size_type find_first_not_of(char c, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of('B');
+  VERIFY( csz01 == 1 );
+  csz01 = str01.find_first_not_of('o', 1);
+  VERIFY( csz01 == 2 );
+  csz01 = str02.find_first_not_of('z');
+  VERIFY( csz01 == 0 );
+  csz01 = str04.find_first_not_of('S');
+  VERIFY( csz01 == npos );
+
+  return true;
+}
+
 int
 main()
-{ 
+{
   test03();
+  static_assert( test04() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc
index f0affe23639..401ef6fa9ad 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc
@@ -61,10 +61,10 @@  test01()
   csz01 = str01.find(str04, 5);
   VERIFY( csz01 == 5 );
   csz01 = str01.find(str04, str01.size());
-  VERIFY( csz01 == str01.size() ); 
+  VERIFY( csz01 == str01.size() );
   csz01 = str01.find(str04, str01.size()+1);
-  VERIFY( csz01 == npos ); 
-  
+  VERIFY( csz01 == npos );
+
   // size_type find(const wchar_t* s, size_type pos, size_type n) const;
   csz01 = str01.find(str_lit01, 0, 3);
   VERIFY( csz01 == 0 );
@@ -85,10 +85,79 @@  test01()
   VERIFY( csz01 == npos );
 }
 
+constexpr bool
+test02()
+{
+  typedef std::wstring_view::size_type csize_type;
+  typedef std::wstring_view::const_reference cref;
+  typedef std::wstring_view::reference ref;
+  csize_type npos = std::wstring_view::npos;
+  csize_type csz01 = 0, csz02 = 0;
+
+  const wchar_t str_lit01[] = L"mave";
+  const std::wstring_view str01(L"mavericks, santa cruz");
+  std::wstring_view str02(str_lit01);
+  std::wstring_view str03(L"s, s");
+  std::wstring_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find(const wstring_view&, size_type pos = 0) const;
+  csz01 = str01.find(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str01, 4);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str02, 3);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find(str03, 12);
+  VERIFY( csz01 == npos );
+
+  // An empty string_view consists of no characters
+  // therefore it should be found at every point in a string_view,
+  // except beyond the end
+  csz01 = str01.find(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str04, 5);
+  VERIFY( csz01 == 5 );
+  csz01 = str01.find(str04, str01.size());
+  VERIFY( csz01 == str01.size() );
+  csz01 = str01.find(str04, str01.size()+1);
+  VERIFY( csz01 == npos );
+
+  // size_type find(const wchar_t* s, size_type pos, size_type n) const;
+  csz01 = str01.find(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3, 0);
+  VERIFY( csz01 == 3 );
+
+  // size_type find(const wchar_t* s, size_type pos = 0) const;
+  csz01 = str01.find(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find(str_lit01, 3);
+  VERIFY( csz01 == npos );
+
+  // size_type find(wchar_t c, size_type pos = 0) const;
+  csz01 = str01.find(L'z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+  csz01 = str01.find(L'/');
+  VERIFY( csz01 == npos );
+
+  return true;
+}
+
 int
 main()
-{ 
+{
   test01();
+  static_assert( test02() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc
index 13434de844e..a74f72f8767 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc
@@ -59,13 +59,13 @@  test02()
   // An empty string_view consists of no characters
   // therefore it should be found at every point in a string_view,
   // except beyond the end
-  // However, str1.find_first_of(str2,pos) finds the first character in 
+  // However, str1.find_first_of(str2,pos) finds the first character in
   // str1 (starting at pos) that exists in str2, which is none for empty str2
   csz01 = str01.find_first_of(str04, 0);
   VERIFY( csz01 == npos );
   csz01 = str01.find_first_of(str04, 5);
   VERIFY( csz01 == npos );
-  
+
   // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const;
   csz01 = str01.find_first_of(str_lit01, 0, 3);
   VERIFY( csz01 == 0 );
@@ -84,10 +84,78 @@  test02()
   VERIFY( csz01 == csz02 );
 }
 
+constexpr bool
+test04()
+{
+  typedef std::wstring_view::size_type csize_type;
+  csize_type npos = std::wstring_view::npos;
+  csize_type csz01 = 0, csz02 = 0;
+
+  const wchar_t str_lit01[] = L"mave";
+  const std::wstring_view str01(L"mavericks, santa cruz");
+  std::wstring_view str02(str_lit01);
+  std::wstring_view str03(L"s, s");
+  std::wstring_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find_first_of(const wstring_view&, size_type pos = 0) const;
+  std::wstring_view str05(L"xena rulez");
+  csz01 = str01.find_first_of(str01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str01, 4);
+  VERIFY( csz01 == 4 );
+  csz01 = str01.find_first_of(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str02, 3);
+  VERIFY( csz01 == 3 );
+  csz01 = str01.find_first_of(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 3);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_of(str03, 12);
+  VERIFY( csz01 == 16 );
+  csz01 = str01.find_first_of(str05, 0);
+  VERIFY( csz01 == 1 );
+  csz01 = str01.find_first_of(str05, 4);
+  VERIFY( csz01 == 4 );
+
+  // An empty string_view consists of no characters
+  // therefore it should be found at every point in a string_view,
+  // except beyond the end
+  // However, str1.find_first_of(str2,pos) finds the first character in
+  // str1 (starting at pos) that exists in str2, which is none for empty str2
+  csz01 = str01.find_first_of(str04, 0);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_of(str04, 5);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const;
+  csz01 = str01.find_first_of(str_lit01, 0, 3);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3, 0);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_of(const wchar_t* s, size_type pos = 0) const;
+  csz01 = str01.find_first_of(str_lit01);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_of(str_lit01, 3);
+  VERIFY( csz01 == 3 );
+
+  // size_type find_first_of(wchar_t c, size_type pos = 0) const;
+  csz01 = str01.find_first_of(L'z');
+  csz02 = str01.size() - 1;
+  VERIFY( csz01 == csz02 );
+
+  return true;
+}
+
 int
 main()
-{ 
+{
   test02();
+  static_assert( test04() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc
index 8c2c81b27f2..901c780b108 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc
@@ -84,10 +84,78 @@  test03()
   VERIFY( csz01 == npos );
 }
 
+constexpr bool
+test04()
+{
+  typedef std::wstring_view::size_type csize_type;
+  csize_type npos = std::wstring_view::npos;
+  csize_type csz01 = 0;
+
+  const std::wstring_view str01(L"Bob Rock, per me");
+  const wchar_t str_lit01[] = L"Bob Rock";
+  std::wstring_view str02(L"ovvero Trivi");
+  std::wstring_view str03(str_lit01);
+  std::wstring_view str04;
+
+#undef VERIFY
+#define VERIFY(x) if(!(x)) return false
+
+  // size_type find_first_not_of(const string_view&, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of(str01);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_not_of(str02, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str02, 10);
+  VERIFY( csz01 == 10 );
+  csz01 = str01.find_first_not_of(str02, 12);
+  VERIFY( csz01 == 14 );
+  csz01 = str01.find_first_not_of(str03, 0);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_not_of(str03, 15);
+  VERIFY( csz01 == 15 );
+  csz01 = str01.find_first_not_of(str03, 16);
+  VERIFY( csz01 == npos );
+  csz01 = str01.find_first_not_of(str04, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str04, 12);
+  VERIFY( csz01 == 12 );
+  csz01 = str03.find_first_not_of(str01, 0);
+  VERIFY( csz01 == npos );
+  csz01 = str04.find_first_not_of(str02, 0);
+  VERIFY( csz01 == npos );
+
+  // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
+  csz01 = str01.find_first_not_of(str_lit01, 0, 0);
+  VERIFY( csz01 == 0 );
+  csz01 = str01.find_first_not_of(str_lit01, 0, 8);
+  VERIFY( csz01 == 8 );
+  csz01 = str01.find_first_not_of(str_lit01, 10, 0);
+  VERIFY( csz01 == 10 );
+
+  // size_type find_first_not_of(const char* s, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of(str_lit01);
+  VERIFY( csz01 == 8 );
+  csz01 = str02.find_first_not_of(str_lit01, 2);
+  VERIFY( csz01 == 2 );
+
+  // size_type find_first_not_of(char c, size_type pos = 0) const;
+  csz01 = str01.find_first_not_of(L'B');
+  VERIFY( csz01 == 1 );
+  csz01 = str01.find_first_not_of(L'o', 1);
+  VERIFY( csz01 == 2 );
+  csz01 = str02.find_first_not_of(L'z');
+  VERIFY( csz01 == 0 );
+  csz01 = str04.find_first_not_of(L'S');
+  VERIFY( csz01 == npos );
+
+  return true;
+}
+
 int
 main()
-{ 
+{
   test03();
+  static_assert( test04() );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/2.cc
index 89130b8363b..93533b38875 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/char/2.cc
@@ -112,7 +112,7 @@  template<class charT, class traits, class Allocator>
 #include <string_view>
 #include <testsuite_hooks.h>
 
-int
+void
 test01()
 {
   std::string_view 	str_0("costa rica");
@@ -120,7 +120,7 @@  test01()
   std::string_view 	str_2("cost");
   std::string_view	str_3("costa ricans");
   std::string_view        str_4;
-  
+
   str_4 = str_0;
   //comparisons between string objects
   VERIFY( !(str_0 == str_1) );
@@ -140,7 +140,131 @@  test01()
   VERIFY( str_3 != str_0 );
   VERIFY( !(str_0 != str_4) );
   VERIFY( !(str_4 != str_0) );
-   
+
+  VERIFY( str_0 > str_1 ); //true cuz r>m
+  VERIFY( str_0 > str_2 );
+  VERIFY( !(str_0 > str_3) );
+  VERIFY( !(str_1 > str_0) ); //false cuz m<r
+  VERIFY( !(str_2 > str_0) );
+  VERIFY( str_3 > str_0 );
+  VERIFY( !(str_0 > str_4) );
+  VERIFY( !(str_4 > str_0) );
+
+  VERIFY( !(str_0 < str_1) ); //false cuz r>m
+  VERIFY( !(str_0 < str_2) );
+  VERIFY( str_0 < str_3 );
+  VERIFY( str_1 < str_0 ); //true cuz m<r
+  VERIFY( str_2 < str_0 );
+  VERIFY( !(str_3 < str_0) );
+  VERIFY( !(str_0 < str_4) );
+  VERIFY( !(str_4 < str_0) );
+
+  VERIFY( str_0 >= str_1 ); //true cuz r>m
+  VERIFY( str_0 >= str_2 );
+  VERIFY( !(str_0 >= str_3) );
+  VERIFY( !(str_1 >= str_0) );//false cuz m<r
+  VERIFY( !(str_2 >= str_0) );
+  VERIFY( str_3 >= str_0 );
+  VERIFY( str_0 >= str_4 );
+  VERIFY( str_4 >= str_0 );
+
+  VERIFY( !(str_0 <= str_1) );//false cuz r>m
+  VERIFY( !(str_0 <= str_2) );
+  VERIFY( str_0 <= str_3 );
+  VERIFY( str_1 <= str_0 );//true cuz m<r
+  VERIFY( str_2 <= str_0 );
+  VERIFY( !(str_3 <= str_0) );
+  VERIFY( str_0 <= str_4 );
+  VERIFY( str_4 <= str_0 );
+
+  //comparisons between string object and string literal
+  VERIFY( !(str_0 == "costa marbella") );
+  VERIFY( !(str_0 == "cost") );
+  VERIFY( !(str_0 == "costa ricans") );
+  VERIFY( !("costa marbella" == str_0) );
+  VERIFY( !("cost" == str_0) );
+  VERIFY( !("costa ricans" == str_0) );
+  VERIFY( "costa rica" == str_0 );
+  VERIFY( str_0 == "costa rica" );
+
+  VERIFY( str_0 != "costa marbella" );
+  VERIFY( str_0 != "cost" );
+  VERIFY( str_0 != "costa ricans" );
+  VERIFY( "costa marbella" != str_0 );
+  VERIFY( "cost" != str_0 );
+  VERIFY( "costa ricans" != str_0 );
+  VERIFY( !("costa rica" != str_0) );
+  VERIFY( !(str_0 != "costa rica") );
+
+  VERIFY( str_0 > "costa marbella" ); //true cuz r>m
+  VERIFY( str_0 > "cost" );
+  VERIFY( !(str_0 > "costa ricans") );
+  VERIFY( !("costa marbella" > str_0) );//false cuz m<r
+  VERIFY( !("cost" > str_0) );
+  VERIFY( "costa ricans" > str_0 );
+  VERIFY( !("costa rica" > str_0) );
+  VERIFY( !(str_0 > "costa rica") );
+
+  VERIFY( !(str_0 < "costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 < "cost") );
+  VERIFY( str_0 < "costa ricans" );
+  VERIFY( "costa marbella" < str_0 );//true cuz m<r
+  VERIFY( "cost" < str_0 );
+  VERIFY( !("costa ricans" < str_0) );
+  VERIFY( !("costa rica" < str_0) );
+  VERIFY( !(str_0 < "costa rica") );
+
+  VERIFY( str_0 >= "costa marbella" );//true cuz r>m
+  VERIFY( str_0 >= "cost" );
+  VERIFY( !(str_0 >= "costa ricans") );
+  VERIFY( !("costa marbella" >= str_0) );//false cuz m<r
+  VERIFY( !("cost" >= str_0) );
+  VERIFY( "costa ricans" >= str_0 );
+  VERIFY( "costa rica" >= str_0 );
+  VERIFY( str_0 >= "costa rica" );
+
+  VERIFY( !(str_0 <= "costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 <= "cost") );
+  VERIFY( str_0 <= "costa ricans" );
+  VERIFY( "costa marbella" <= str_0 );//true cuz m<r
+  VERIFY( "cost" <= str_0 );
+  VERIFY( !("costa ricans" <= str_0) );
+  VERIFY( "costa rica" <= str_0 );
+  VERIFY( str_0 <= "costa rica" );
+}
+
+constexpr bool
+test02()
+{
+  std::string_view 	str_0("costa rica");
+  std::string_view 	str_1("costa marbella");
+  std::string_view 	str_2("cost");
+  std::string_view	str_3("costa ricans");
+  std::string_view        str_4;
+
+#undef VERIFY
+#define VERIFY(x) if (!(x)) return false
+
+  str_4 = str_0;
+  //comparisons between string objects
+  VERIFY( !(str_0 == str_1) );
+  VERIFY( !(str_0 == str_2) );
+  VERIFY( !(str_0 == str_3) );
+  VERIFY( !(str_1 == str_0) );
+  VERIFY( !(str_2 == str_0) );
+  VERIFY( !(str_3 == str_0) );
+  VERIFY( str_4 == str_0 );
+  VERIFY( str_0 == str_4 );
+
+  VERIFY( str_0 != str_1 );
+  VERIFY( str_0 != str_2 );
+  VERIFY( str_0 != str_3 );
+  VERIFY( str_1 != str_0 );
+  VERIFY( str_2 != str_0 );
+  VERIFY( str_3 != str_0 );
+  VERIFY( !(str_0 != str_4) );
+  VERIFY( !(str_4 != str_0) );
+
   VERIFY( str_0 > str_1 ); //true cuz r>m
   VERIFY( str_0 > str_2 );
   VERIFY( !(str_0 > str_3) );
@@ -232,13 +356,12 @@  test01()
   VERIFY( "costa rica" <= str_0 );
   VERIFY( str_0 <= "costa rica" );
 
-  return 0;
+  return true;
 }
 
 int
-main() 
+main()
 {
   test01();
-
-  return 0;
+  static_assert( test02() );
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc
index dce819469cd..916dce9c9ad 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc
@@ -45,7 +45,7 @@  template<class charT, class traits, class Allocator>
                   const basic_string_view<charT,traits,Allocator>& rhs);
 
 template<class charT, class traits, class Allocator>
-  bool operator!=(const basic_string_view<charT,traits,Allocator>& lhs, 
+  bool operator!=(const basic_string_view<charT,traits,Allocator>& lhs,
                   const charT* rhs);
 */
 
@@ -60,7 +60,7 @@  template<class charT, class traits, class Allocator>
                   const charT* rhs);
 
 template<class charT, class traits, class Allocator>
-  bool operator< (const charT* lhs, 
+  bool operator< (const charT* lhs,
                   const basic_string_view<charT,traits,Allocator>& rhs);
 */
 
@@ -112,7 +112,7 @@  template<class charT, class traits, class Allocator>
 #include <string_view>
 #include <testsuite_hooks.h>
 
-int
+void
 test01()
 {
   std::wstring_view 	str_0(L"costa rica");
@@ -120,7 +120,7 @@  test01()
   std::wstring_view 	str_2(L"cost");
   std::wstring_view	str_3(L"costa ricans");
   std::wstring_view  str_4;
-  
+
   str_4 = str_0;
   //comparisons between string_view objects
   VERIFY( !(str_0 == str_1) );
@@ -140,7 +140,131 @@  test01()
   VERIFY( str_3 != str_0 );
   VERIFY( !(str_0 != str_4) );
   VERIFY( !(str_4 != str_0) );
-   
+
+  VERIFY( str_0 > str_1 ); //true cuz r>m
+  VERIFY( str_0 > str_2 );
+  VERIFY( !(str_0 > str_3) );
+  VERIFY( !(str_1 > str_0) ); //false cuz m<r
+  VERIFY( !(str_2 > str_0) );
+  VERIFY( str_3 > str_0 );
+  VERIFY( !(str_0 > str_4) );
+  VERIFY( !(str_4 > str_0) );
+
+  VERIFY( !(str_0 < str_1) ); //false cuz r>m
+  VERIFY( !(str_0 < str_2) );
+  VERIFY( str_0 < str_3 );
+  VERIFY( str_1 < str_0 ); //true cuz m<r
+  VERIFY( str_2 < str_0 );
+  VERIFY( !(str_3 < str_0) );
+  VERIFY( !(str_0 < str_4) );
+  VERIFY( !(str_4 < str_0) );
+
+  VERIFY( str_0 >= str_1 ); //true cuz r>m
+  VERIFY( str_0 >= str_2 );
+  VERIFY( !(str_0 >= str_3) );
+  VERIFY( !(str_1 >= str_0) );//false cuz m<r
+  VERIFY( !(str_2 >= str_0) );
+  VERIFY( str_3 >= str_0 );
+  VERIFY( str_0 >= str_4 );
+  VERIFY( str_4 >= str_0 );
+
+  VERIFY( !(str_0 <= str_1) );//false cuz r>m
+  VERIFY( !(str_0 <= str_2) );
+  VERIFY( str_0 <= str_3 );
+  VERIFY( str_1 <= str_0 );//true cuz m<r
+  VERIFY( str_2 <= str_0 );
+  VERIFY( !(str_3 <= str_0) );
+  VERIFY( str_0 <= str_4 );
+  VERIFY( str_4 <= str_0 );
+
+  //comparisons between string_view object and string_view literal
+  VERIFY( !(str_0 == L"costa marbella") );
+  VERIFY( !(str_0 == L"cost") );
+  VERIFY( !(str_0 == L"costa ricans") );
+  VERIFY( !(L"costa marbella" == str_0) );
+  VERIFY( !(L"cost" == str_0) );
+  VERIFY( !(L"costa ricans" == str_0) );
+  VERIFY( L"costa rica" == str_0 );
+  VERIFY( str_0 == L"costa rica" );
+
+  VERIFY( str_0 != L"costa marbella" );
+  VERIFY( str_0 != L"cost" );
+  VERIFY( str_0 != L"costa ricans" );
+  VERIFY( L"costa marbella" != str_0 );
+  VERIFY( L"cost" != str_0 );
+  VERIFY( L"costa ricans" != str_0 );
+  VERIFY( !(L"costa rica" != str_0) );
+  VERIFY( !(str_0 != L"costa rica") );
+
+  VERIFY( str_0 > L"costa marbella" ); //true cuz r>m
+  VERIFY( str_0 > L"cost" );
+  VERIFY( !(str_0 > L"costa ricans") );
+  VERIFY( !(L"costa marbella" > str_0) );//false cuz m<r
+  VERIFY( !(L"cost" > str_0) );
+  VERIFY( L"costa ricans" > str_0 );
+  VERIFY( !(L"costa rica" > str_0) );
+  VERIFY( !(str_0 > L"costa rica") );
+
+  VERIFY( !(str_0 < L"costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 < L"cost") );
+  VERIFY( str_0 < L"costa ricans" );
+  VERIFY( L"costa marbella" < str_0 );//true cuz m<r
+  VERIFY( L"cost" < str_0 );
+  VERIFY( !(L"costa ricans" < str_0) );
+  VERIFY( !(L"costa rica" < str_0) );
+  VERIFY( !(str_0 < L"costa rica") );
+
+  VERIFY( str_0 >= L"costa marbella" );//true cuz r>m
+  VERIFY( str_0 >= L"cost" );
+  VERIFY( !(str_0 >= L"costa ricans") );
+  VERIFY( !(L"costa marbella" >= str_0) );//false cuz m<r
+  VERIFY( !(L"cost" >= str_0) );
+  VERIFY( L"costa ricans" >= str_0 );
+  VERIFY( L"costa rica" >= str_0 );
+  VERIFY( str_0 >= L"costa rica" );
+
+  VERIFY( !(str_0 <= L"costa marbella") );//false cuz r>m
+  VERIFY( !(str_0 <= L"cost") );
+  VERIFY( str_0 <= L"costa ricans" );
+  VERIFY( L"costa marbella" <= str_0 );//true cuz m<r
+  VERIFY( L"cost" <= str_0 );
+  VERIFY( !(L"costa ricans" <= str_0) );
+  VERIFY( L"costa rica" <= str_0 );
+  VERIFY( str_0 <= L"costa rica" );
+}
+
+constexpr bool
+test02()
+{
+  std::wstring_view 	str_0(L"costa rica");
+  std::wstring_view 	str_1(L"costa marbella");
+  std::wstring_view 	str_2(L"cost");
+  std::wstring_view	str_3(L"costa ricans");
+  std::wstring_view  str_4;
+
+#undef VERIFY
+#define VERIFY(x) if (!(x)) return false
+
+  str_4 = str_0;
+  //comparisons between string_view objects
+  VERIFY( !(str_0 == str_1) );
+  VERIFY( !(str_0 == str_2) );
+  VERIFY( !(str_0 == str_3) );
+  VERIFY( !(str_1 == str_0) );
+  VERIFY( !(str_2 == str_0) );
+  VERIFY( !(str_3 == str_0) );
+  VERIFY( str_4 == str_0 );
+  VERIFY( str_0 == str_4 );
+
+  VERIFY( str_0 != str_1 );
+  VERIFY( str_0 != str_2 );
+  VERIFY( str_0 != str_3 );
+  VERIFY( str_1 != str_0 );
+  VERIFY( str_2 != str_0 );
+  VERIFY( str_3 != str_0 );
+  VERIFY( !(str_0 != str_4) );
+  VERIFY( !(str_4 != str_0) );
+
   VERIFY( str_0 > str_1 ); //true cuz r>m
   VERIFY( str_0 > str_2 );
   VERIFY( !(str_0 > str_3) );
@@ -232,13 +356,12 @@  test01()
   VERIFY( L"costa rica" <= str_0 );
   VERIFY( str_0 <= L"costa rica" );
 
-  return 0;
+  return true;
 }
 
 int
-main() 
+main()
 {
   test01();
-
-  return 0;
+  static_assert( test02() );
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/char/1.cc
index e46d7eda2ba..5b65aa79dec 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/char/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/char/1.cc
@@ -18,7 +18,7 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 24.6.5, range access [iterator.range]
+// C++17 27.7, range access [iterator.range]
 
 #include <string_view>
 
@@ -28,4 +28,20 @@  test01()
   std::string_view s("Hello, World!");
   std::begin(s);
   std::end(s);
+  std::rbegin(s);
+  std::rend(s);
+}
+
+void
+test02()
+{
+  constexpr std::string_view s("Hello, World!");
+  [[maybe_unused]] constexpr auto b = std::begin(s);
+  [[maybe_unused]] constexpr auto e = std::end(s);
+  [[maybe_unused]] constexpr auto cb = std::cbegin(s);
+  [[maybe_unused]] constexpr auto ce = std::cend(s);
+  [[maybe_unused]] constexpr auto rb = std::rbegin(s);
+  [[maybe_unused]] constexpr auto re = std::rend(s);
+  [[maybe_unused]] constexpr auto crb = std::crbegin(s);
+  [[maybe_unused]] constexpr auto cre = std::crend(s);
 }
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc
index 9c0370c20b7..84086615bb0 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc
@@ -18,16 +18,30 @@ 
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 24.6.5, range access [iterator.range]
+// C++17 27.7, range access [iterator.range]
 
 #include <string_view>
 
 void
 test01()
 {
-#ifdef _GLIBCXX_USE_WCHAR_T
   std::wstring_view ws(L"Hello, World!");
   std::begin(ws);
   std::end(ws);
-#endif
+  std::rbegin(ws);
+  std::rend(ws);
+}
+
+void
+test02()
+{
+  constexpr std::wstring_view ws(L"Hello, World!");
+  [[maybe_unused]] constexpr auto b = std::begin(ws);
+  [[maybe_unused]] constexpr auto e = std::end(ws);
+  [[maybe_unused]] constexpr auto cb = std::cbegin(ws);
+  [[maybe_unused]] constexpr auto ce = std::cend(ws);
+  [[maybe_unused]] constexpr auto rb = std::rbegin(ws);
+  [[maybe_unused]] constexpr auto re = std::rend(ws);
+  [[maybe_unused]] constexpr auto crb = std::crbegin(ws);
+  [[maybe_unused]] constexpr auto cre = std::crend(ws);
 }