[libcxx] r238270 - Cleanup move/forward tests and remove references to __rv.

Eric Fiselier eric at efcs.ca
Tue May 26 17:51:08 PDT 2015


Author: ericwf
Date: Tue May 26 19:51:08 2015
New Revision: 238270

URL: http://llvm.org/viewvc/llvm-project?rev=238270&view=rev
Log:
Cleanup move/forward tests and remove references to __rv.

Modified:
    libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp
    libcxx/trunk/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
    libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp

Modified: libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp?rev=238270&r1=238269&r2=238270&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/forward/move_copy.pass.cpp Tue May 26 19:51:08 2015
@@ -9,6 +9,8 @@
 
 // test move
 
+// UNSUPPORTED: c++98, c++03
+
 #include <utility>
 #include <cassert>
 
@@ -17,25 +19,13 @@ int move_ctor = 0;
 
 class A
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#else
-#endif
-
 public:
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     A(const A&) {++copy_ctor;}
     A& operator=(const A&);
 
     A(A&&) {++move_ctor;}
     A& operator=(A&&);
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    A(const A&) {++copy_ctor;}
-    A& operator=(A&);
-
-    operator std::__rv<A> () {return std::__rv<A>(*this);}
-    A(std::__rv<A>) {++move_ctor;}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     A() {}
 };

Modified: libcxx/trunk/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp?rev=238270&r1=238269&r2=238270&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp Tue May 26 19:51:08 2015
@@ -20,6 +20,8 @@
 
 #include <utility>
 
+#include "test_macros.h"
+
 class A
 {
     A(const A&);
@@ -27,7 +29,7 @@ class A
 public:
 
     A() {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
     A(A&&) {}
 #endif
 };
@@ -47,20 +49,23 @@ int main()
     A a;
     const A ca;
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
     static_assert((std::is_same<decltype(std::move_if_noexcept(i)), int&&>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&&>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(a)), A&&>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&&>::value), "");
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
+#else  // C++ < 11
+    // libc++ defines decltype to be __typeof__ in C++03. __typeof__ does not
+    // deduce the reference qualifiers.
     static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A>::value), "");
     static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A>::value), "");
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
+    static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy>::value), "");
+#endif
 
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
     constexpr int i1 = 23;
     constexpr int i2 = std::move_if_noexcept(i1);
     static_assert(i2 == 23, "" );

Modified: libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp?rev=238270&r1=238269&r2=238270&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/forward/move_only.pass.cpp Tue May 26 19:51:08 2015
@@ -9,28 +9,18 @@
 
 // test move
 
+// UNSUPPORTED: c++98, c++03
+
 #include <utility>
 #include <cassert>
 
 class move_only
 {
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     move_only(const move_only&);
     move_only& operator=(const move_only&);
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    move_only(move_only&);
-    move_only& operator=(move_only&);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     move_only(move_only&&) {}
     move_only& operator=(move_only&&) {return *this;}
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
-    move_only(std::__rv<move_only>) {}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     move_only() {}
 };





More information about the cfe-commits mailing list