From ee6bfb2117c932b186066b53a8f3c5a80bffc8bb Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 27 May 2015 00:51:08 +0000 Subject: [PATCH] Cleanup move/forward tests and remove references to __rv. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238270 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../utility/forward/move_copy.pass.cpp | 14 ++------------ .../utility/forward/move_if_noexcept.pass.cpp | 17 +++++++++++------ .../utility/forward/move_only.pass.cpp | 14 ++------------ 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/test/std/utilities/utility/forward/move_copy.pass.cpp b/test/std/utilities/utility/forward/move_copy.pass.cpp index 461a876c..fa15553f 100644 --- a/test/std/utilities/utility/forward/move_copy.pass.cpp +++ b/test/std/utilities/utility/forward/move_copy.pass.cpp @@ -9,6 +9,8 @@ // test move +// UNSUPPORTED: c++98, c++03 + #include #include @@ -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 () {return std::__rv(*this);} - A(std::__rv) {++move_ctor;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES A() {} }; diff --git a/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp index f94ff2a6..c8375e9d 100644 --- a/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp +++ b/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp @@ -20,6 +20,8 @@ #include +#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::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + static_assert((std::is_same::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::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - static_assert((std::is_same::value), ""); + static_assert((std::is_same::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, "" ); diff --git a/test/std/utilities/utility/forward/move_only.pass.cpp b/test/std/utilities/utility/forward/move_only.pass.cpp index 0588c110..520bf5e5 100644 --- a/test/std/utilities/utility/forward/move_only.pass.cpp +++ b/test/std/utilities/utility/forward/move_only.pass.cpp @@ -9,28 +9,18 @@ // test move +// UNSUPPORTED: c++98, c++03 + #include #include 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 () {return std::__rv(*this);} - move_only(std::__rv) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES move_only() {} };