[libcxx] r272613 - Remove _LIBCPP_TRIVIAL_PAIR_COPY_CTOR option.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 18:36:15 PDT 2016


Author: ericwf
Date: Mon Jun 13 20:36:15 2016
New Revision: 272613

URL: http://llvm.org/viewvc/llvm-project?rev=272613&view=rev
Log:
Remove _LIBCPP_TRIVIAL_PAIR_COPY_CTOR option.

Added:
    libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
    libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/utility
    libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=272613&r1=272612&r2=272613&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Jun 13 20:36:15 2016
@@ -745,8 +745,8 @@ template <unsigned> struct __static_asse
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
-#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
+#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+#  error the "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" option is no longer supported
 #endif
 
 #ifndef _LIBCPP_STD_VER
@@ -879,7 +879,9 @@ 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)
+#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) \
+ || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)  \
+ || defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTION)
 #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=272613&r1=272612&r2=272613&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Mon Jun 13 20:36:15 2016
@@ -310,18 +310,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
                                       )
             : first(__p.first), second(__p.second) {}
 
-#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)
-    {
-    }
+#if !defined(_LIBCPP_CXX03_LANG)
+    _LIBCPP_INLINE_VISIBILITY pair(const pair& __p) = default;
+    _LIBCPP_INLINE_VISIBILITY pair(pair&& __p) = default;
 #endif
 
     _LIBCPP_INLINE_VISIBILITY
@@ -353,19 +344,6 @@ 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 &&

Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp?rev=272613&r1=272612&r2=272613&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp Mon Jun 13 20:36:15 2016
@@ -13,9 +13,6 @@
 
 // pair(const pair&) = default;
 
-// Doesn't pass due to use of is_trivially_* trait.
-// XFAIL: gcc-4.9
-
 #include <utility>
 #include <cassert>
 
@@ -30,9 +27,6 @@ int main()
         assert(p2.first == 3);
         assert(p2.second == 4);
     }
-
-    static_assert((std::is_trivially_copy_constructible<std::pair<int, int> >::value), "");
-
 #if TEST_STD_VER > 11
     {
         typedef std::pair<int, short> P1;

Added: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp?rev=272613&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp Mon Jun 13 20:36:15 2016
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(pair&&) = default;
+
+#include <utility>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Dummy {
+  Dummy(Dummy const&) = delete;
+  Dummy(Dummy &&) = default;
+};
+
+int main()
+{
+    {
+        typedef std::pair<int, short> P1;
+        static_assert(std::is_move_constructible<P1>::value, "");
+        P1 p1(3, 4);
+        P1 p2 = std::move(p1);
+        assert(p2.first == 3);
+        assert(p2.second == 4);
+    }
+    {
+        using P = std::pair<Dummy, int>;
+        static_assert(!std::is_copy_constructible<P>::value, "");
+        static_assert(std::is_move_constructible<P>::value, "");
+    }
+}

Added: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp?rev=272613&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp Mon Jun 13 20:36:15 2016
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(pair const&) = default;
+// pair(pair&&) = default;
+
+// Doesn't pass due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Dummy {
+  Dummy(Dummy const&) = delete;
+  Dummy(Dummy &&) = default;
+};
+
+int main()
+{
+    typedef std::pair<int, short> P;
+    {
+        static_assert(std::is_copy_constructible<P>::value, "");
+        static_assert(std::is_trivially_copy_constructible<P>::value, "");
+    }
+#if TEST_STD_VER >= 11
+    {
+        static_assert(std::is_move_constructible<P>::value, "");
+        static_assert(std::is_trivially_move_constructible<P>::value, "");
+    }
+    {
+        using P1 = std::pair<Dummy, int>;
+        static_assert(!std::is_copy_constructible<P1>::value, "");
+        static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
+        static_assert(std::is_move_constructible<P1>::value, "");
+        static_assert(std::is_trivially_move_constructible<P1>::value, "");
+    }
+#endif
+}




More information about the cfe-commits mailing list