Make the string_view literal operators constexpr like the ctors they call.

Ed Smith-Rowland 3dw4rd@verizon.net
Sat Mar 8 16:29:00 GMT 2014


On 03/08/2014 11:27 AM, Ed Smith-Rowland wrote:
> The title says it all.  This was just an oversight in the original patch.
>
> This could wait until stage 1 obviously.  I just wanted to post it.
>
> There are a lot of post-Issaquah constexpr changes but these will have 
> to wait for front-end support for C++14 constexpr.
>
> Builds and tests clean on x86_64-linux.
>
> OK?
>
>
And the actual patch...  ;-)

-------------- next part --------------
2014-03-08  Ed Smith-Rowland  <3dw4rd@verizon.net>

	* include/experimental/string_view: Make the literal operators
	constexpr like the ctors they call.

-------------- next part --------------
Index: include/experimental/string_view
===================================================================
--- include/experimental/string_view	(revision 208430)
+++ include/experimental/string_view	(working copy)
@@ -674,22 +674,22 @@
   inline namespace string_view_literals
   {
 
-    inline basic_string_view<char>
+    inline constexpr basic_string_view<char>
     operator""sv(const char* __str, size_t __len)
     { return basic_string_view<char>{__str, __len}; }
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-    inline basic_string_view<wchar_t>
+    inline constexpr basic_string_view<wchar_t>
     operator""sv(const wchar_t* __str, size_t __len)
     { return basic_string_view<wchar_t>{__str, __len}; }
 #endif
 
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
-    inline basic_string_view<char16_t>
+    inline constexpr basic_string_view<char16_t>
     operator""sv(const char16_t* __str, size_t __len)
     { return basic_string_view<char16_t>{__str, __len}; }
 
-    inline basic_string_view<char32_t>
+    inline constexpr basic_string_view<char32_t>
     operator""sv(const char32_t* __str, size_t __len)
     { return basic_string_view<char32_t>{__str, __len}; }
 #endif


More information about the Libstdc++ mailing list