[libcxx] r272671 - Partially Revert r272613. FreeBSD needs the non-trivial constructors in pair.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 07:34:19 PDT 2016


Author: ericwf
Date: Tue Jun 14 09:34:19 2016
New Revision: 272671

URL: http://llvm.org/viewvc/llvm-project?rev=272671&view=rev
Log:
Partially Revert r272613. FreeBSD needs the non-trivial constructors in pair.

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/utility

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=272671&r1=272670&r2=272671&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Jun 14 09:34:19 2016
@@ -746,8 +746,8 @@ template <unsigned> struct __static_asse
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
-#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-#  error the "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" option is no longer supported
+#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
 #endif
 
 #ifndef _LIBCPP_STD_VER
@@ -880,9 +880,7 @@ extern "C" void __sanitizer_annotate_con
 #if __cplusplus < 201103L
 #define _LIBCPP_CXX03_LANG
 #else
-#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) \
- || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)  \
- || defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTION)
+#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 #error Libc++ requires a feature complete C++11 compiler in C++11 or greater.
 #endif
 #endif

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=272671&r1=272670&r2=272671&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Tue Jun 14 09:34:19 2016
@@ -310,9 +310,18 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
                                       )
             : first(__p.first), second(__p.second) {}
 
-#if !defined(_LIBCPP_CXX03_LANG)
-    _LIBCPP_INLINE_VISIBILITY pair(const pair& __p) = default;
-    _LIBCPP_INLINE_VISIBILITY pair(pair&& __p) = default;
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+    _LIBCPP_INLINE_VISIBILITY
+    pair(const pair& __p) = default;
+#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+    _LIBCPP_INLINE_VISIBILITY
+    pair(const pair& __p)
+        _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
+                   is_nothrow_copy_constructible<second_type>::value)
+        : first(__p.first),
+          second(__p.second)
+    {
+    }
 #endif
 
     _LIBCPP_INLINE_VISIBILITY
@@ -344,6 +353,19 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
             : first(_VSTD::forward<_U1>(__p.first)),
               second(_VSTD::forward<_U2>(__p.second)) {}
 
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+    _LIBCPP_INLINE_VISIBILITY
+    pair(pair&& __p) = default;
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<first_type>::value &&
+                                is_nothrow_move_constructible<second_type>::value)
+        : first(_VSTD::forward<first_type>(__p.first)),
+          second(_VSTD::forward<second_type>(__p.second))
+    {
+    }
+#endif
+
     _LIBCPP_INLINE_VISIBILITY
     pair&
     operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&




More information about the cfe-commits mailing list