PR libstdc++/80939 Remove unmeetable constexpr specifiers
authorJonathan Wakely <jwakely@redhat.com>
Mon, 5 Jun 2017 16:49:04 +0000 (17:49 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 5 Jun 2017 16:49:04 +0000 (17:49 +0100)
PR libstdc++/80939
* include/std/variant (__erased_ctor, __erased_assign, __erased_swap)
(__erased_hash): Remove constexpr specifier and qualify calls to
__ref_cast.
(__erased_dtor): Remove constexpr specifier and use _Destroy.

From-SVN: r248881

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/variant

index 0b0881091e3dd20b2fe3c95b7867f56ed24fb53b..9abc73cb5791813fbfdf81f4f64e15739215d25d 100644 (file)
@@ -1,3 +1,11 @@
+2017-06-02  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/80939
+       * include/std/variant (__erased_ctor, __erased_assign, __erased_swap)
+       (__erased_hash): Remove constexpr specifier and qualify calls to
+       __ref_cast.
+       (__erased_dtor): Remove constexpr specifier and use _Destroy.
+
 2017-06-05  Jonathan Wakely  <jwakely@redhat.com>
 
        * include/bits/stl_iterator_base_funcs.h
index b9824a5182c1dab9eb498c63dc66b365267a55c6..e5fe9f927c1621e3959464e8277489b756d02547 100644 (file)
@@ -44,6 +44,9 @@
 #include <bits/invoke.h>
 #include <ext/aligned_buffer.h>
 #include <bits/parse_numbers.h>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_construct.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -238,30 +241,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Various functions as "vtable" entries, where those vtables are used by
   // polymorphic operations.
   template<typename _Lhs, typename _Rhs>
-    constexpr void
+    void
     __erased_ctor(void* __lhs, void* __rhs)
-    { ::new (__lhs) remove_reference_t<_Lhs>(__ref_cast<_Rhs>(__rhs)); }
+    {
+      using _Type = remove_reference_t<_Lhs>;
+      ::new (__lhs) _Type(__variant::__ref_cast<_Rhs>(__rhs));
+    }
 
   template<typename _Variant, size_t _Np>
-    constexpr void
+    void
     __erased_dtor(_Variant&& __v)
-    {
-      auto&& __element = __get<_Np>(std::forward<_Variant>(__v));
-      using _Type = std::remove_reference_t<decltype(__element)>;
-      __element.~_Type();
-    }
+    { std::_Destroy(std::__addressof(__get<_Np>(__v))); }
 
   template<typename _Lhs, typename _Rhs>
-    constexpr void
+    void
     __erased_assign(void* __lhs, void* __rhs)
-    { __ref_cast<_Lhs>(__lhs) = __ref_cast<_Rhs>(__rhs); }
+    {
+      __variant::__ref_cast<_Lhs>(__lhs) = __variant::__ref_cast<_Rhs>(__rhs);
+    }
 
   template<typename _Lhs, typename _Rhs>
-    constexpr void
+    void
     __erased_swap(void* __lhs, void* __rhs)
     {
       using std::swap;
-      swap(__ref_cast<_Lhs>(__lhs), __ref_cast<_Rhs>(__rhs));
+      swap(__variant::__ref_cast<_Lhs>(__lhs),
+          __variant::__ref_cast<_Rhs>(__rhs));
     }
 
 #define _VARIANT_RELATION_FUNCTION_TEMPLATE(__OP, __NAME) \
@@ -283,11 +288,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #undef _VARIANT_RELATION_FUNCTION_TEMPLATE
 
   template<typename _Tp>
-    constexpr size_t
+    size_t
     __erased_hash(void* __t)
     {
       return std::hash<remove_cv_t<remove_reference_t<_Tp>>>{}(
-         __ref_cast<_Tp>(__t));
+         __variant::__ref_cast<_Tp>(__t));
     }
 
   // Defines members and ctors.