From 3a8fa93ae088f53b302dae7c0487d1a37ad1e2c0 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 27 May 2015 00:51:08 +0000 Subject: Cleanup move/forward tests and remove references to __rv. llvm-svn: 238270 --- .../std/utilities/utility/forward/move_copy.pass.cpp | 14 ++------------ .../utilities/utility/forward/move_if_noexcept.pass.cpp | 17 +++++++++++------ .../std/utilities/utility/forward/move_only.pass.cpp | 14 ++------------ 3 files changed, 15 insertions(+), 30 deletions(-) (limited to 'libcxx') diff --git a/libcxx/test/std/utilities/utility/forward/move_copy.pass.cpp b/libcxx/test/std/utilities/utility/forward/move_copy.pass.cpp index 461a876cac8..fa15553f669 100644 --- a/libcxx/test/std/utilities/utility/forward/move_copy.pass.cpp +++ b/libcxx/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/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp index f94ff2a6097..c8375e9d723 100644 --- a/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp +++ b/libcxx/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/libcxx/test/std/utilities/utility/forward/move_only.pass.cpp b/libcxx/test/std/utilities/utility/forward/move_only.pass.cpp index 0588c110f1d..520bf5e5b6a 100644 --- a/libcxx/test/std/utilities/utility/forward/move_only.pass.cpp +++ b/libcxx/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() {} }; -- cgit v1.2.3