diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-05-27 00:51:08 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-05-27 00:51:08 +0000 |
commit | 3a8fa93ae088f53b302dae7c0487d1a37ad1e2c0 (patch) | |
tree | 15aafa909f3183b28cc4b9dd94720db1cc2c013a /libcxx | |
parent | 8cd99e9a5a13bc3f229dbabc9e8baa7b10568598 (diff) | |
download | bcm5719-llvm-3a8fa93ae088f53b302dae7c0487d1a37ad1e2c0.tar.gz bcm5719-llvm-3a8fa93ae088f53b302dae7c0487d1a37ad1e2c0.zip |
Cleanup move/forward tests and remove references to __rv.
llvm-svn: 238270
Diffstat (limited to 'libcxx')
3 files changed, 15 insertions, 30 deletions
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 <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() {} }; 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 <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, "" ); 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 <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() {} }; |