loladiro updated this revision to Diff 71528.
loladiro added a comment.

Add private copy of forward (__forward) that is constexpr even in C++11 mode, 
use test suggested by @rsmith


Repository:
  rL LLVM

https://reviews.llvm.org/D24372

Files:
  include/memory
  
test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/constinit.pass.cpp

Index: test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/constinit.pass.cpp
===================================================================
--- /dev/null
+++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/constinit.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+#include <memory>
+#include <cassert>
+
+#ifndef _LIBCPP_SAFE_STATIC
+#define _LIBCPP_SAFE_STATIC
+#endif
+
+extern std::unique_ptr<int> a;
+extern std::unique_ptr<int> b;
+void *tramplea = std::memset(&a, 0xab, sizeof(a));
+void *trampleb = std::memset(&b, 0xab, sizeof(b));
+_LIBCPP_SAFE_STATIC std::unique_ptr<int> a;
+_LIBCPP_SAFE_STATIC std::unique_ptr<int> b(nullptr);
+
+int main() {
+    // Check that the initialization of 'a' was performed before the initialization of 'tramplea'.
+    for (size_t n = 0; n != sizeof(a); ++n)
+      assert(reinterpret_cast<unsigned char*>(tramplea)[n] == 0xab);
+    // Check that the initialization of 'b' was performed before the initialization of 'trampleb'.
+    for (size_t n = 0; n != sizeof(b); ++n)
+      assert(reinterpret_cast<unsigned char*>(trampleb)[n] == 0xab);
+    // Put a unique_ptr object back so that the global dtor is valid.
+    new (&a) std::unique_ptr<int>;
+    new (&b) std::unique_ptr<int>;
+}
Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -2053,6 +2053,26 @@
     typedef void element_type;
 };
 
+// Private copy of forward, for use only in this file, which is constexpr even
+// in C++11
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+_Tp&&
+__forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
+{
+    return static_cast<_Tp&&>(__t);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+_Tp&&
+__forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT
+{
+    static_assert(!is_lvalue_reference<_Tp>::value,
+                  "Can not forward an rvalue as an lvalue.");
+    return static_cast<_Tp&&>(__t);
+}
+
 template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
                                                      typename remove_cv<_T2>::type>::value,
                                 bool = is_empty<_T1>::value
@@ -2096,24 +2116,28 @@
     typedef const typename remove_reference<_T1>::type& _T1_const_reference;
     typedef const typename remove_reference<_T2>::type& _T2_const_reference;
 
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
-        : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
-        : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
-        : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp() : __first_(), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : __first_(__forward<_T1_param>(__t1)), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : __first_(), __second_(__forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : __first_(__forward<_T1_param>(__t1)), __second_(__forward<_T2_param>(__t2)) {}
 
 #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
                    is_nothrow_copy_constructible<_T2>::value)
         : __first_(__p.first()),
           __second_(__p.second()) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
                    is_nothrow_copy_assignable<_T2>::value)
@@ -2123,36 +2147,36 @@
             return *this;
         }
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
-        : __first_(_VSTD::forward<_T1>(__p.first())),
-          __second_(_VSTD::forward<_T2>(__p.second())) {}
+        : __first_(__forward<_T1>(__p.first())),
+          __second_(__forward<_T2>(__p.second())) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
                    is_nothrow_move_assignable<_T2>::value)
         {
-            __first_ = _VSTD::forward<_T1>(__p.first());
-            __second_ = _VSTD::forward<_T2>(__p.second());
+            __first_ = __forward<_T1>(__p.first());
+            __second_ = __forward<_T2>(__p.second());
             return *this;
         }
 
 #endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
                                      __tuple_indices<_I2...>)
-            : __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
-              __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            : __first_(__forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              __second_(__forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
             {}
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
@@ -2189,23 +2213,27 @@
     typedef const _T1&                                        _T1_const_reference;
     typedef const typename remove_reference<_T2>::type& _T2_const_reference;
 
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
-        : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
-        : __second_(_VSTD::forward<_T2_param>(__t2)) {}
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
-        : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp() : __second_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : _T1(__forward<_T1_param>(__t1)), __second_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : __second_(__forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : _T1(__forward<_T1_param>(__t1)), __second_(__forward<_T2_param>(__t2)) {}
 
 #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
                    is_nothrow_copy_constructible<_T2>::value)
         : _T1(__p.first()), __second_(__p.second()) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
                    is_nothrow_copy_assignable<_T2>::value)
@@ -2215,35 +2243,35 @@
             return *this;
         }
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
-        : _T1(_VSTD::move(__p.first())), __second_(_VSTD::forward<_T2>(__p.second())) {}
+        : _T1(_VSTD::move(__p.first())), __second_(__forward<_T2>(__p.second())) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
                    is_nothrow_move_assignable<_T2>::value)
         {
             _T1::operator=(_VSTD::move(__p.first()));
-            __second_ = _VSTD::forward<_T2>(__p.second());
+            __second_ = __forward<_T2>(__p.second());
             return *this;
         }
 
 #endif  // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
                                      __tuple_indices<_I2...>)
-            : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
-              __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            : _T1(__forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              __second_(__forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
             {}
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
@@ -2279,25 +2307,29 @@
     typedef const typename remove_reference<_T1>::type& _T1_const_reference;
     typedef const _T2&                                        _T2_const_reference;
 
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
-        : __first_(_VSTD::forward<_T1_param>(__t1)) {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
-        : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp() : __first_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : __first_(__forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : _T2(__forward<_T2_param>(__t2)), __first_() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
-        : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {}
+        : _T2(__forward<_T2_param>(__t2)), __first_(__forward<_T1_param>(__t1)) {}
 
 #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
                    is_nothrow_copy_constructible<_T2>::value)
         : _T2(__p.second()), __first_(__p.first()) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
                    is_nothrow_copy_assignable<_T2>::value)
@@ -2307,18 +2339,18 @@
             return *this;
         }
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
-        : _T2(_VSTD::forward<_T2>(__p.second())), __first_(_VSTD::move(__p.first())) {}
+        : _T2(__forward<_T2>(__p.second())), __first_(_VSTD::move(__p.first())) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
                    is_nothrow_move_assignable<_T2>::value)
         {
-            _T2::operator=(_VSTD::forward<_T2>(__p.second()));
+            _T2::operator=(__forward<_T2>(__p.second()));
             __first_ = _VSTD::move(__p.first());
             return *this;
         }
@@ -2328,14 +2360,14 @@
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
                                      __tuple_indices<_I2...>)
-            : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...),
-              __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...)
+            : _T2(__forward<_Args2>(_VSTD::get<_I2>(__second_args))...),
+              __first_(__forward<_Args1>(_VSTD::get<_I1>(__first_args))...)
               
             {}
 
@@ -2371,23 +2403,27 @@
     typedef const _T1& _T1_const_reference;
     typedef const _T2& _T2_const_reference;
 
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
-        : _T1(_VSTD::forward<_T1_param>(__t1)) {}
-    _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
-        : _T2(_VSTD::forward<_T2_param>(__t2)) {}
-    _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
-        : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T1_param __t1)
+        : _T1(__forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __libcpp_compressed_pair_imp(_T2_param __t2)
+        : _T2(__forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
+        : _T1(__forward<_T1_param>(__t1)), _T2(__forward<_T2_param>(__t2)) {}
 
 #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
                    is_nothrow_copy_constructible<_T2>::value)
         : _T1(__p.first()), _T2(__p.second()) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p)
         _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
                    is_nothrow_copy_assignable<_T2>::value)
@@ -2397,13 +2433,13 @@
             return *this;
         }
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
         : _T1(_VSTD::move(__p.first())), _T2(_VSTD::move(__p.second())) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p)
         _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
                    is_nothrow_move_assignable<_T2>::value)
@@ -2418,14 +2454,14 @@
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
                                      __tuple_indices<_I2...>)
-            : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
-              _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
+            : _T1(__forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
+              _T2(__forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
             {}
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
@@ -2458,38 +2494,41 @@
     typedef typename base::_T1_const_reference _T1_const_reference;
     typedef typename base::_T2_const_reference _T2_const_reference;
 
-    _LIBCPP_INLINE_VISIBILITY __compressed_pair() {}
-    _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
-        : base(_VSTD::forward<_T1_param>(__t1)) {}
-    _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
-        : base(_VSTD::forward<_T2_param>(__t2)) {}
-    _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
-        : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair() {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __compressed_pair(_T1_param __t1)
+        : base(__forward<_T1_param>(__t1)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    explicit __compressed_pair(_T2_param __t2)
+        : base(__forward<_T2_param>(__t2)) {}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    __compressed_pair(_T1_param __t1, _T2_param __t2)
+        : base(__forward<_T1_param>(__t1), __forward<_T2_param>(__t2)) {}
 
 #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __compressed_pair(const __compressed_pair& __p)
         _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value &&
                    is_nothrow_copy_constructible<_T2>::value)
         : base(__p) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __compressed_pair& operator=(const __compressed_pair& __p)
         _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value &&
                    is_nothrow_copy_assignable<_T2>::value)
         {
             base::operator=(__p);
             return *this;
         }
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __compressed_pair(__compressed_pair&& __p)
         _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
                    is_nothrow_move_constructible<_T2>::value)
         : base(_VSTD::move(__p)) {}
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     __compressed_pair& operator=(__compressed_pair&& __p)
         _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value &&
                    is_nothrow_move_assignable<_T2>::value)
@@ -2503,7 +2542,7 @@
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
     template <class... _Args1, class... _Args2>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
         __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
                                                       tuple<_Args2...> __second_args)
             : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to