diff options
Diffstat (limited to 'libcxx/test/utilities/utility')
48 files changed, 0 insertions, 1924 deletions
diff --git a/libcxx/test/utilities/utility/declval/declval.pass.cpp b/libcxx/test/utilities/utility/declval/declval.pass.cpp deleted file mode 100644 index 81f4df8e8b2..00000000000 --- a/libcxx/test/utilities/utility/declval/declval.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 T> typename add_rvalue_reference<T>::type declval() noexcept; - -#include <utility> -#include <type_traits> - -class A -{ - A(const A&); - A& operator=(const A&); -}; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - static_assert((std::is_same<decltype(std::declval<A>()), A&&>::value), ""); -#else - static_assert((std::is_same<decltype(std::declval<A>()), A>::value), ""); -#endif -} diff --git a/libcxx/test/utilities/utility/exchange/exchange.pass.cpp b/libcxx/test/utilities/utility/exchange/exchange.pass.cpp deleted file mode 100644 index 620b4149d1d..00000000000 --- a/libcxx/test/utilities/utility/exchange/exchange.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// utilities - -// exchange - -#include <utility> -#include <cassert> -#include <string> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - { - int v = 12; - assert ( std::exchange ( v, 23 ) == 12 ); - assert ( v == 23 ); - assert ( std::exchange ( v, 67.2 ) == 23 ); - assert ( v == 67 ); - - assert ((std::exchange<int, float> ( v, {} )) == 67 ); - assert ( v == 0 ); - - } - - { - bool b = false; - assert ( !std::exchange ( b, true )); - assert ( b ); - } - - { - const std::string s1 ( "Hi Mom!" ); - const std::string s2 ( "Yo Dad!" ); - std::string s3 = s1; // Mom - assert ( std::exchange ( s3, s2 ) == s1 ); - assert ( s3 == s2 ); - assert ( std::exchange ( s3, "Hi Mom!" ) == s2 ); - assert ( s3 == s1 ); - - s3 = s2; // Dad - assert ( std::exchange ( s3, {} ) == s2 ); - assert ( s3.size () == 0 ); - - s3 = s2; // Dad - assert ( std::exchange ( s3, "" ) == s2 ); - assert ( s3.size () == 0 ); - } - -#endif -} diff --git a/libcxx/test/utilities/utility/forward/forward.pass.cpp b/libcxx/test/utilities/utility/forward/forward.pass.cpp deleted file mode 100644 index 357b36fafa9..00000000000 --- a/libcxx/test/utilities/utility/forward/forward.pass.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> -#include <cassert> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -typedef char one; -struct two {one _[2];}; -struct four {one _[4];}; -struct eight {one _[8];}; - -one test(A&); -two test(const A&); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -four test(A&&); -eight test(const A&&); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - A a; - const A ca = A(); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - static_assert(sizeof(test(std::forward<A&>(a))) == 1, ""); - static_assert(sizeof(test(std::forward<A>(a))) == 4, ""); - static_assert(sizeof(test(std::forward<A>(source()))) == 4, ""); - - static_assert(sizeof(test(std::forward<const A&>(a))) == 2, ""); -// static_assert(sizeof(test(std::forward<const A&>(source()))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(a))) == 8, ""); - static_assert(sizeof(test(std::forward<const A>(source()))) == 8, ""); - - static_assert(sizeof(test(std::forward<const A&>(ca))) == 2, ""); -// static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(ca))) == 8, ""); - static_assert(sizeof(test(std::forward<const A>(csource()))) == 8, ""); - -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - - static_assert(sizeof(test(std::forward<A&>(a))) == 1, ""); - static_assert(sizeof(test(std::forward<A>(a))) == 1, ""); -// static_assert(sizeof(test(std::forward<A>(source()))) == 2, ""); - - static_assert(sizeof(test(std::forward<const A&>(a))) == 2, ""); - static_assert(sizeof(test(std::forward<const A&>(source()))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(a))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(source()))) == 2, ""); - - static_assert(sizeof(test(std::forward<const A&>(ca))) == 2, ""); - static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(ca))) == 2, ""); - static_assert(sizeof(test(std::forward<const A>(csource()))) == 2, ""); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#if _LIBCPP_STD_VER > 11 - constexpr int i1 = std::move(23); - static_assert(i1 == 23, "" ); - constexpr int i2 = std::forward<int>(42); - static_assert(i2 == 42, "" ); -#endif -} diff --git a/libcxx/test/utilities/utility/forward/forward1.fail.cpp b/libcxx/test/utilities/utility/forward/forward1.fail.cpp deleted file mode 100644 index 43884d54bf8..00000000000 --- a/libcxx/test/utilities/utility/forward/forward1.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -int main() -{ - std::forward<A&>(source()); // error -} diff --git a/libcxx/test/utilities/utility/forward/forward2.fail.cpp b/libcxx/test/utilities/utility/forward/forward2.fail.cpp deleted file mode 100644 index 9ff07233fee..00000000000 --- a/libcxx/test/utilities/utility/forward/forward2.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -int main() -{ - const A ca = A(); - std::forward<A&>(ca); // error -} diff --git a/libcxx/test/utilities/utility/forward/forward3.fail.cpp b/libcxx/test/utilities/utility/forward/forward3.fail.cpp deleted file mode 100644 index 7e1e9b38fdc..00000000000 --- a/libcxx/test/utilities/utility/forward/forward3.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -int main() -{ - std::forward<A&>(csource()); // error -} diff --git a/libcxx/test/utilities/utility/forward/forward4.fail.cpp b/libcxx/test/utilities/utility/forward/forward4.fail.cpp deleted file mode 100644 index 276506f811b..00000000000 --- a/libcxx/test/utilities/utility/forward/forward4.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -int main() -{ - const A ca = A(); - std::forward<A>(ca); // error -} diff --git a/libcxx/test/utilities/utility/forward/forward5.fail.cpp b/libcxx/test/utilities/utility/forward/forward5.fail.cpp deleted file mode 100644 index 86c2b5651b9..00000000000 --- a/libcxx/test/utilities/utility/forward/forward5.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -A source() {return A();} -const A csource() {return A();} - -int main() -{ - const A ca = A(); - std::forward<A>(csource()); // error -} diff --git a/libcxx/test/utilities/utility/forward/forward6.fail.cpp b/libcxx/test/utilities/utility/forward/forward6.fail.cpp deleted file mode 100644 index 1f4b37d946c..00000000000 --- a/libcxx/test/utilities/utility/forward/forward6.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test forward - -#include <utility> - -struct A -{ -}; - -int main() -{ - A a; - std::forward(a); // error -} diff --git a/libcxx/test/utilities/utility/forward/move_copy.pass.cpp b/libcxx/test/utilities/utility/forward/move_copy.pass.cpp deleted file mode 100644 index 461a876cac8..00000000000 --- a/libcxx/test/utilities/utility/forward/move_copy.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#include <utility> -#include <cassert> - -int copy_ctor = 0; -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() {} -}; - -A source() {return A();} -const A csource() {return A();} - -void test(A) {} - -int main() -{ - A a; - const A ca = A(); - - assert(copy_ctor == 0); - assert(move_ctor == 0); - - A a2 = a; - assert(copy_ctor == 1); - assert(move_ctor == 0); - - A a3 = std::move(a); - assert(copy_ctor == 1); - assert(move_ctor == 1); - - A a4 = ca; - assert(copy_ctor == 2); - assert(move_ctor == 1); - - A a5 = std::move(ca); - assert(copy_ctor == 3); - assert(move_ctor == 1); -} diff --git a/libcxx/test/utilities/utility/forward/move_if_noexcept.pass.cpp b/libcxx/test/utilities/utility/forward/move_if_noexcept.pass.cpp deleted file mode 100644 index f94ff2a6097..00000000000 --- a/libcxx/test/utilities/utility/forward/move_if_noexcept.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 T> -// typename conditional -// < -// !is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value, -// const T&, -// T&& -// >::type -// move_if_noexcept(T& x); - -#include <utility> - -class A -{ - A(const A&); - A& operator=(const A&); -public: - - A() {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - A(A&&) {} -#endif -}; - -struct legacy -{ - legacy() {} - legacy(const legacy&); -}; - -int main() -{ - int i = 0; - const int ci = 0; - - legacy l; - A a; - const A ca; - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - 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(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), ""); - -#if _LIBCPP_STD_VER > 11 - constexpr int i1 = 23; - constexpr int i2 = std::move_if_noexcept(i1); - static_assert(i2 == 23, "" ); -#endif - -} diff --git a/libcxx/test/utilities/utility/forward/move_only.pass.cpp b/libcxx/test/utilities/utility/forward/move_only.pass.cpp deleted file mode 100644 index 0588c110f1d..00000000000 --- a/libcxx/test/utilities/utility/forward/move_only.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#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() {} -}; - -move_only source() {return move_only();} -const move_only csource() {return move_only();} - -void test(move_only) {} - -int main() -{ - move_only mo; - - test(std::move(mo)); - test(source()); -} diff --git a/libcxx/test/utilities/utility/forward/move_only1.fail.cpp b/libcxx/test/utilities/utility/forward/move_only1.fail.cpp deleted file mode 100644 index 5e7623a1bd1..00000000000 --- a/libcxx/test/utilities/utility/forward/move_only1.fail.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#include <utility> -#include <cassert> - -#include <typeinfo> -#include <stdio.h> - -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&&) {} -#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() {} -}; - -move_only source() {return move_only();} -const move_only csource() {return move_only();} - -void test(move_only) {} - -int main() -{ - move_only a; - const move_only ca = move_only(); - - test(a); -} diff --git a/libcxx/test/utilities/utility/forward/move_only2.fail.cpp b/libcxx/test/utilities/utility/forward/move_only2.fail.cpp deleted file mode 100644 index 2043f3d4bde..00000000000 --- a/libcxx/test/utilities/utility/forward/move_only2.fail.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#include <utility> -#include <cassert> - -#include <typeinfo> -#include <stdio.h> - -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&&) {} -#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() {} -}; - -move_only source() {return move_only();} -const move_only csource() {return move_only();} - -void test(move_only) {} - -int main() -{ - move_only a; - const move_only ca = move_only(); - - test(ca); -} diff --git a/libcxx/test/utilities/utility/forward/move_only3.fail.cpp b/libcxx/test/utilities/utility/forward/move_only3.fail.cpp deleted file mode 100644 index 84c83ae48f8..00000000000 --- a/libcxx/test/utilities/utility/forward/move_only3.fail.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#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&&) {} -#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() {} -}; - -move_only source() {return move_only();} -const move_only csource() {return move_only();} - -void test(move_only) {} - -int main() -{ - move_only a; - const move_only ca = move_only(); - - test(std::move(ca)); -} diff --git a/libcxx/test/utilities/utility/forward/move_only4.fail.cpp b/libcxx/test/utilities/utility/forward/move_only4.fail.cpp deleted file mode 100644 index 5eeca89abe3..00000000000 --- a/libcxx/test/utilities/utility/forward/move_only4.fail.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test move - -#include <utility> -#include <cassert> - -#include <typeinfo> -#include <stdio.h> - -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&&) {} -#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() {} -}; - -move_only source() {return move_only();} -const move_only csource() {return move_only();} - -void test(move_only) {} - -int main() -{ - move_only a; - const move_only ca = move_only(); - - test(csource()); -} diff --git a/libcxx/test/utilities/utility/operators/rel_ops.pass.cpp b/libcxx/test/utilities/utility/operators/rel_ops.pass.cpp deleted file mode 100644 index 26e766592f2..00000000000 --- a/libcxx/test/utilities/utility/operators/rel_ops.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// test rel_ops - -#include <utility> -#include <cassert> - -struct A -{ - int data_; - - explicit A(int data = -1) : data_(data) {} -}; - -inline -bool -operator == (const A& x, const A& y) -{ - return x.data_ == y.data_; -} - -inline -bool -operator < (const A& x, const A& y) -{ - return x.data_ < y.data_; -} - -int main() -{ - using namespace std::rel_ops; - A a1(1); - A a2(2); - assert(a1 == a1); - assert(a1 != a2); - assert(a1 < a2); - assert(a2 > a1); - assert(a1 <= a1); - assert(a1 <= a2); - assert(a2 >= a2); - assert(a2 >= a1); -} diff --git a/libcxx/test/utilities/utility/pairs/nothing_to_do.pass.cpp b/libcxx/test/utilities/utility/pairs/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b64..00000000000 --- a/libcxx/test/utilities/utility/pairs/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.fail.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.fail.cpp deleted file mode 100644 index dbe1c266866..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.fail.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<size_t I, class T1, class T2> -// const typename tuple_element<I, std::pair<T1, T2> >::type& -// get(const pair<T1, T2>&); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P; - const P p(3, 4); - assert(std::get<0>(p) == 3); - assert(std::get<1>(p) == 4); - std::get<0>(p) = 5; - } -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp deleted file mode 100644 index fcda3664d9b..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<size_t I, class T1, class T2> -// const typename tuple_element<I, std::pair<T1, T2> >::type& -// get(const pair<T1, T2>&); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P; - const P p(3, 4); - assert(std::get<0>(p) == 3); - assert(std::get<1>(p) == 4); - } - -#if __cplusplus > 201103L - { - typedef std::pair<int, short> P; - constexpr P p1(3, 4); - static_assert(std::get<0>(p1) == 3, ""); - static_assert(std::get<1>(p1) == 4, ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp deleted file mode 100644 index 6d61c47ffbf..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<size_t I, class T1, class T2> -// typename tuple_element<I, std::pair<T1, T2> >::type& -// get(pair<T1, T2>&); - -#include <utility> -#include <cassert> - -#if __cplusplus > 201103L -struct S { - std::pair<int, int> a; - int k; - constexpr S() : a{1,2}, k(std::get<0>(a)) {} - }; - -constexpr std::pair<int, int> getP () { return { 3, 4 }; } -#endif - -int main() -{ - { - typedef std::pair<int, short> P; - P p(3, 4); - assert(std::get<0>(p) == 3); - assert(std::get<1>(p) == 4); - std::get<0>(p) = 5; - std::get<1>(p) = 6; - assert(std::get<0>(p) == 5); - assert(std::get<1>(p) == 6); - } - -#if __cplusplus > 201103L - { - static_assert(S().k == 1, ""); - static_assert(std::get<1>(getP()) == 4, ""); - } -#endif - -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp deleted file mode 100644 index aa5ca530913..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<size_t I, class T1, class T2> -// typename tuple_element<I, std::pair<T1, T2> >::type&& -// get(pair<T1, T2>&&); - -#include <utility> -#include <memory> -#include <cassert> - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<int>, short> P; - P p(std::unique_ptr<int>(new int(3)), 4); - std::unique_ptr<int> ptr = std::get<0>(std::move(p)); - assert(*ptr == 3); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp deleted file mode 100644 index 176d58330d1..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include <utility> -#include <string> -#include <complex> - -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - typedef std::complex<float> cf; - { - auto t1 = std::make_pair<int, cf> ( 42, { 1,2 } ); - assert ( std::get<int>(t1) == 42 ); - assert ( std::get<cf>(t1).real() == 1 ); - assert ( std::get<cf>(t1).imag() == 2 ); - } - - { - const std::pair<int, const int> p1 { 1, 2 }; - const int &i1 = std::get<int>(p1); - const int &i2 = std::get<const int>(p1); - assert ( i1 == 1 ); - assert ( i2 == 2 ); - } - - { - typedef std::unique_ptr<int> upint; - std::pair<upint, int> t(upint(new int(4)), 42); - upint p = std::get<0>(std::move(t)); // get rvalue - assert(*p == 4); - assert(std::get<0>(t) == nullptr); // has been moved from - } - -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp deleted file mode 100644 index 27194effe5c..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include <utility> -#include <complex> - -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - typedef std::complex<float> cf; - auto t1 = std::make_pair<int, double> ( 42, 3.4 ); - assert (( std::get<cf>(t1) == cf {1,2} )); // no such type -#else -#error -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp deleted file mode 100644 index f9e3942d7e7..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type2.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include <utility> -#include <complex> - -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - typedef std::complex<float> cf; - auto t1 = std::make_pair<int, int> ( 42, 43 ); - assert ( std::get<int>(t1) == 42 ); // two ints -#else -#error -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp deleted file mode 100644 index 48434734574..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/pairs.by.type3.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include <utility> -#include <complex> - -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - typedef std::unique_ptr<int> upint; - std::pair<upint, int> t(upint(new int(4)), 23); - upint p = std::get<upint>(t); -#else -#error -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp deleted file mode 100644 index 9a303bae32f..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// tuple_element<I, pair<T1, T2> >::type - -#include <utility> - -int main() -{ - { - typedef std::pair<int, short> P1; - static_assert((std::is_same<std::tuple_element<0, P1>::type, int>::value), ""); - static_assert((std::is_same<std::tuple_element<1, P1>::type, short>::value), ""); - } - { - typedef std::pair<int*, char> P1; - static_assert((std::is_same<std::tuple_element<0, P1>::type, int*>::value), ""); - static_assert((std::is_same<std::tuple_element<1, P1>::type, char>::value), ""); - } -} diff --git a/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp deleted file mode 100644 index 2be694e8a30..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// tuple_size<pair<T1, T2> >::value - -#include <utility> - -int main() -{ - { - typedef std::pair<int, short> P1; - static_assert((std::tuple_size<P1>::value == 2), ""); - } -} diff --git a/libcxx/test/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp b/libcxx/test/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp deleted file mode 100644 index 90476bcde28..00000000000 --- a/libcxx/test/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// struct piecewise_construct_t { }; -// constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); - -#include <utility> -#include <tuple> -#include <cassert> - -class A -{ - int i_; - char c_; -public: - A(int i, char c) : i_(i), c_(c) {} - int get_i() const {return i_;} - char get_c() const {return c_;} -}; - -class B -{ - double d_; - unsigned u1_; - unsigned u2_; -public: - B(double d, unsigned u1, unsigned u2) : d_(d), u1_(u1), u2_(u2) {} - double get_d() const {return d_;} - unsigned get_u1() const {return u1_;} - unsigned get_u2() const {return u2_;} -}; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_VARIADICS - std::pair<A, B> p(std::piecewise_construct, - std::make_tuple(4, 'a'), - std::make_tuple(3.5, 6u, 2u)); - assert(p.first.get_i() == 4); - assert(p.first.get_c() == 'a'); - assert(p.second.get_d() == 3.5); - assert(p.second.get_u1() == 6u); - assert(p.second.get_u2() == 2u); -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.general/nothing_to_do.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b64..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp deleted file mode 100644 index 8c7dee2499d..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<class U, class V> pair(U&& x, V&& y); - -#include <utility> -#include <memory> -#include <cassert> - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<int>, short*> P; - P p(std::unique_ptr<int>(new int(3)), nullptr); - assert(*p.first == 3); - assert(p.second == nullptr); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp deleted file mode 100644 index fdef5961437..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<class U, class V> pair& operator=(const pair<U, V>& p); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - typedef std::pair<double, long> P2; - P1 p1(3, 4); - P2 p2; - p2 = p1; - assert(p2.first == 3); - assert(p2.second == 4); - } -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp deleted file mode 100644 index a753ee520df..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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& operator=(pair&& p); - -#include <utility> -#include <memory> -#include <cassert> - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<int>, short> P; - P p1(std::unique_ptr<int>(new int(3)), 4); - P p2; - p2 = std::move(p1); - assert(*p2.first == 3); - assert(p2.second == 4); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp deleted file mode 100644 index a200390f488..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template<class U, class V> pair& operator=(pair<U, V>&& p); - -#include <utility> -#include <memory> -#include <cassert> - -struct Base -{ - virtual ~Base() {} -}; - -struct Derived - : public Base -{ -}; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<Derived>, short> P1; - typedef std::pair<std::unique_ptr<Base>, long> P2; - P1 p1(std::unique_ptr<Derived>(), 4); - P2 p2; - p2 = std::move(p1); - assert(p2.first == nullptr); - assert(p2.second == 4); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp deleted file mode 100644 index 2041b39c2dc..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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(const T1& x, const T2& y); - -#include <utility> -#include <cassert> - -class A -{ - int data_; -public: - A(int data) : data_(data) {} - - bool operator==(const A& a) const {return data_ == a.data_;} -}; - -#if _LIBCPP_STD_VER > 11 -class AC -{ - int data_; -public: - constexpr AC(int data) : data_(data) {} - - constexpr bool operator==(const AC& a) const {return data_ == a.data_;} -}; -#endif - -int main() -{ - { - typedef std::pair<float, short*> P; - P p(3.5f, 0); - assert(p.first == 3.5f); - assert(p.second == nullptr); - } - { - typedef std::pair<A, int> P; - P p(1, 2); - assert(p.first == A(1)); - assert(p.second == 2); - } - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<float, short*> P; - constexpr P p(3.5f, 0); - static_assert(p.first == 3.5f, ""); - static_assert(p.second == nullptr, ""); - } - { - typedef std::pair<AC, int> P; - constexpr P p(1, 2); - static_assert(p.first == AC(1), ""); - static_assert(p.second == 2, ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp deleted file mode 100644 index 286cce47f05..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class U, class V> pair(const pair<U, V>& p); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - typedef std::pair<double, long> P2; - P1 p1(3, 4); - P2 p2 = p1; - assert(p2.first == 3); - assert(p2.second == 4); - } - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<int, short> P1; - typedef std::pair<double, long> P2; - constexpr P1 p1(3, 4); - constexpr P2 p2 = p1; - static_assert(p2.first == 3, ""); - static_assert(p2.second == 4, ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp deleted file mode 100644 index 4b54f717045..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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(const pair&) = default; - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - P1 p1(3, 4); - P1 p2 = p1; - assert(p2.first == 3); - assert(p2.second == 4); - } - - static_assert((std::is_trivially_copy_constructible<std::pair<int, int> >::value), ""); - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<int, short> P1; - constexpr P1 p1(3, 4); - constexpr P1 p2 = p1; - static_assert(p2.first == 3, ""); - static_assert(p2.second == 4, ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/default.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/default.pass.cpp deleted file mode 100644 index bb6661f7966..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/default.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// constexpr pair(); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<float, short*> P; - P p; - assert(p.first == 0.0f); - assert(p.second == nullptr); - } - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<float, short*> P; - constexpr P p; - static_assert(p.first == 0.0f, ""); - static_assert(p.second == nullptr, ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp deleted file mode 100644 index 42a2666dd04..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class... Args1, class... Args2> -// pair(piecewise_construct_t, tuple<Args1...> first_args, -// tuple<Args2...> second_args); - -#include <utility> -#include <tuple> -#include <cassert> - -int main() -{ -#ifndef _LIBCPP_HAS_NO_VARIADICS - { - typedef std::pair<int, int*> P1; - typedef std::pair<int*, int> P2; - typedef std::pair<P1, P2> P3; - P3 p3(std::piecewise_construct, std::tuple<int, int*>(3, nullptr), - std::tuple<int*, int>(nullptr, 4)); - assert(p3.first == P1(3, nullptr)); - assert(p3.second == P2(nullptr, 4)); - } -#endif // _LIBCPP_HAS_NO_VARIADICS -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp deleted file mode 100644 index 5fb6c98979b..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class U, class V> pair(pair<U, V>&& p); - -#include <utility> -#include <memory> -#include <cassert> - -struct Base -{ - virtual ~Base() {} -}; - -struct Derived - : public Base -{ -}; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<Derived>, short> P1; - typedef std::pair<std::unique_ptr<Base>, long> P2; - P1 p1(std::unique_ptr<Derived>(), 4); - P2 p2 = std::move(p1); - assert(p2.first == nullptr); - assert(p2.second == 4); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/swap.pass.cpp deleted file mode 100644 index a912df00d7b..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/swap.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// void swap(pair& p); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - P1 p1(3, 4); - P1 p2(5, 6); - p1.swap(p2); - assert(p1.first == 5); - assert(p1.second == 6); - assert(p2.first == 3); - assert(p2.second == 4); - } -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.pair/types.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.pair/types.pass.cpp deleted file mode 100644 index c16bd71ffcb..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.pair/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// { -// typedef T1 first_type; -// typedef T2 second_type; - -#include <utility> -#include <type_traits> - -int main() -{ - typedef std::pair<float, short*> P; - static_assert((std::is_same<P::first_type, float>::value), ""); - static_assert((std::is_same<P::second_type, short*>::value), ""); -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.spec/comparison.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.spec/comparison.pass.cpp deleted file mode 100644 index 9ba8532ab29..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.spec/comparison.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); -// template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); -// template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); -// template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); -// template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); -// template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P; - P p1(3, 4); - P p2(3, 4); - assert( (p1 == p2)); - assert(!(p1 != p2)); - assert(!(p1 < p2)); - assert( (p1 <= p2)); - assert(!(p1 > p2)); - assert( (p1 >= p2)); - } - { - typedef std::pair<int, short> P; - P p1(2, 4); - P p2(3, 4); - assert(!(p1 == p2)); - assert( (p1 != p2)); - assert( (p1 < p2)); - assert( (p1 <= p2)); - assert(!(p1 > p2)); - assert(!(p1 >= p2)); - } - { - typedef std::pair<int, short> P; - P p1(3, 2); - P p2(3, 4); - assert(!(p1 == p2)); - assert( (p1 != p2)); - assert( (p1 < p2)); - assert( (p1 <= p2)); - assert(!(p1 > p2)); - assert(!(p1 >= p2)); - } - { - typedef std::pair<int, short> P; - P p1(3, 4); - P p2(2, 4); - assert(!(p1 == p2)); - assert( (p1 != p2)); - assert(!(p1 < p2)); - assert(!(p1 <= p2)); - assert( (p1 > p2)); - assert( (p1 >= p2)); - } - { - typedef std::pair<int, short> P; - P p1(3, 4); - P p2(3, 2); - assert(!(p1 == p2)); - assert( (p1 != p2)); - assert(!(p1 < p2)); - assert(!(p1 <= p2)); - assert( (p1 > p2)); - assert( (p1 >= p2)); - } - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<int, short> P; - constexpr P p1(3, 4); - constexpr P p2(3, 2); - static_assert(!(p1 == p2), ""); - static_assert( (p1 != p2), ""); - static_assert(!(p1 < p2), ""); - static_assert(!(p1 <= p2), ""); - static_assert( (p1 > p2), ""); - static_assert( (p1 >= p2), ""); - } -#endif -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp deleted file mode 100644 index 48e09735abb..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> pair<V1, V2> make_pair(T1&&, T2&&); - -#include <utility> -#include <memory> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - P1 p1 = std::make_pair(3, 4); - assert(p1.first == 3); - assert(p1.second == 4); - } - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::pair<std::unique_ptr<int>, short> P1; - P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), 4); - assert(*p1.first == 3); - assert(p1.second == 4); - } - { - typedef std::pair<std::unique_ptr<int>, short> P1; - P1 p1 = std::make_pair(nullptr, 4); - assert(p1.first == nullptr); - assert(p1.second == 4); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#if _LIBCPP_STD_VER > 11 - { - typedef std::pair<int, short> P1; - constexpr P1 p1 = std::make_pair(3, 4); - static_assert(p1.first == 3, ""); - static_assert(p1.second == 4, ""); - } -#endif - -} diff --git a/libcxx/test/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp b/libcxx/test/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp deleted file mode 100644 index d9d8f27b522..00000000000 --- a/libcxx/test/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 - -// template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y); - -#include <utility> -#include <cassert> - -int main() -{ - { - typedef std::pair<int, short> P1; - P1 p1(3, 4); - P1 p2(5, 6); - swap(p1, p2); - assert(p1.first == 5); - assert(p1.second == 6); - assert(p2.first == 3); - assert(p2.second == 4); - } -} diff --git a/libcxx/test/utilities/utility/utility.swap/swap.pass.cpp b/libcxx/test/utilities/utility/utility.swap/swap.pass.cpp deleted file mode 100644 index 8606611f660..00000000000 --- a/libcxx/test/utilities/utility/utility.swap/swap.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 T> -// requires MoveAssignable<T> && MoveConstructible<T> -// void -// swap(T& a, T& b); - -#include <utility> -#include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#include <memory> -#endif - -void -test() -{ - int i = 1; - int j = 2; - std::swap(i, j); - assert(i == 2); - assert(j == 1); -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -void -test1() -{ - std::unique_ptr<int> i(new int(1)); - std::unique_ptr<int> j(new int(2)); - std::swap(i, j); - assert(*i == 2); - assert(*j == 1); -} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1(); -#endif -} diff --git a/libcxx/test/utilities/utility/utility.swap/swap_array.pass.cpp b/libcxx/test/utilities/utility/utility.swap/swap_array.pass.cpp deleted file mode 100644 index b1209c3c365..00000000000 --- a/libcxx/test/utilities/utility/utility.swap/swap_array.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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<ValueType T, size_t N> -// requires Swappable<T> -// void -// swap(T (&a)[N], T (&b)[N]); - -#include <utility> -#include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#include <memory> -#endif - -void -test() -{ - int i[3] = {1, 2, 3}; - int j[3] = {4, 5, 6}; - std::swap(i, j); - assert(i[0] == 4); - assert(i[1] == 5); - assert(i[2] == 6); - assert(j[0] == 1); - assert(j[1] == 2); - assert(j[2] == 3); -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -void -test1() -{ - std::unique_ptr<int> i[3]; - for (int k = 0; k < 3; ++k) - i[k].reset(new int(k+1)); - std::unique_ptr<int> j[3]; - for (int k = 0; k < 3; ++k) - j[k].reset(new int(k+4)); - std::swap(i, j); - assert(*i[0] == 4); - assert(*i[1] == 5); - assert(*i[2] == 6); - assert(*j[0] == 1); - assert(*j[1] == 2); - assert(*j[2] == 3); -} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1(); -#endif -} diff --git a/libcxx/test/utilities/utility/version.pass.cpp b/libcxx/test/utilities/utility/version.pass.cpp deleted file mode 100644 index 77d145d9445..00000000000 --- a/libcxx/test/utilities/utility/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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> - -#include <utility> - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} |