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

Ed Smith-Rowland 3dw4rd@verizon.net
Fri Jul 25 03:50:00 GMT 2014


On 03/08/2014 01:33 PM, Jonathan Wakely wrote:
> On 8 March 2014 16:29, Ed Smith-Rowland wrote:
>> 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?
> OK for stage 1, but not now.  (And please remember to CC gcc-patches)
>
I had completely forgotten about this until now.

Rebased, retested, committed.

Ed

-------------- next part --------------
2014-07-25  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 212967)
+++ include/experimental/string_view	(working copy)
@@ -664,22 +664,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