From 0564cdb94a7a1facbb0dbf888ceb90638aa70ecd Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:12:08 +0000 Subject: Vendor import of libc++ trunk r321017: https://llvm.org/svn/llvm-project/libcxx/trunk@321017 --- .../arithmetic.operations/transparent.pass.cpp | 10 ++++---- .../bitwise.operations/transparent.pass.cpp | 10 ++++---- .../comparisons/transparent.pass.cpp | 10 ++++---- .../func.invoke/invoke_feature_test_macro.pass.cpp | 2 +- .../function.objects/func.not_fn/not_fn.pass.cpp | 18 +++++++-------- .../func.require/binary_function.pass.cpp | 2 ++ .../func.require/unary_function.pass.cpp | 2 ++ .../func.wrap/func.wrap.func/derive_from.pass.cpp | 3 ++- .../func.wrap.func.con/alloc_F.fail.cpp | 2 +- .../func.wrap.func.con/alloc_F.pass.cpp | 2 +- .../func.wrap.func.con/alloc_function.fail.cpp | 6 ++--- .../logical.operations/transparent.pass.cpp | 10 ++++---- .../refwrap/refwrap.access/conversion.pass.cpp | 1 - .../refwrap/refwrap.assign/copy_assign.pass.cpp | 1 - .../refwrap/refwrap.const/copy_ctor.pass.cpp | 1 - .../refwrap/refwrap.const/type_ctor.pass.cpp | 1 - .../function.objects/refwrap/weak_result.pass.cpp | 27 +++++++++++++++++----- .../function.objects/unord.hash/non_enum.pass.cpp | 6 ++--- .../function.objects/unord.hash/pointer.pass.cpp | 2 +- 19 files changed, 66 insertions(+), 50 deletions(-) (limited to 'test/std/utilities/function.objects') diff --git a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp index b85f439ba7a0..fce826f4215d 100644 --- a/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp +++ b/test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp @@ -11,15 +11,15 @@ #include #include -template +template struct is_transparent { private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); + struct two {char lx; char lxx;}; + template static two test(...); + template static char test(typename U::is_transparent* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = sizeof(test(0)) == 1; }; diff --git a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp index db7168c44f8b..bcd353eba1e2 100644 --- a/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp +++ b/test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp @@ -11,15 +11,15 @@ #include #include -template +template struct is_transparent { private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); + struct two {char lx; char lxx;}; + template static two test(...); + template static char test(typename U::is_transparent* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = sizeof(test(0)) == 1; }; diff --git a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp index f353fe7a72a6..ebae262b2423 100644 --- a/test/std/utilities/function.objects/comparisons/transparent.pass.cpp +++ b/test/std/utilities/function.objects/comparisons/transparent.pass.cpp @@ -11,15 +11,15 @@ #include #include -template +template struct is_transparent { private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); + struct two {char lx; char lxx;}; + template static two test(...); + template static char test(typename U::is_transparent* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = sizeof(test(0)) == 1; }; diff --git a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp index aaac98474fcb..9c3f24262ef0 100644 --- a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp +++ b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp @@ -36,4 +36,4 @@ int main() { #if defined(__cpp_lib_invoke) assert(std::invoke(foo, 101) == 42); #endif -} \ No newline at end of file +} diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index aa8eb3916db9..7601ff9d147d 100644 --- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -438,26 +438,26 @@ void throws_in_constructor_test() void call_operator_sfinae_test() { { // wrong number of arguments using T = decltype(std::not_fn(returns_true)); - static_assert(std::is_callable::value, ""); // callable only with no args - static_assert(!std::is_callable::value, ""); + static_assert(std::is_invocable::value, ""); // callable only with no args + static_assert(!std::is_invocable::value, ""); } { // violates const correctness (member function pointer) using T = decltype(std::not_fn(&MemFunCallable::return_value_nc)); - static_assert(std::is_callable::value, ""); - static_assert(!std::is_callable::value, ""); + static_assert(std::is_invocable::value, ""); + static_assert(!std::is_invocable::value, ""); } { // violates const correctness (call object) using Obj = CopyCallable; using NCT = decltype(std::not_fn(Obj{true})); using CT = const NCT; - static_assert(std::is_callable::value, ""); - static_assert(!std::is_callable::value, ""); + static_assert(std::is_invocable::value, ""); + static_assert(!std::is_invocable::value, ""); } { // returns bad type with no operator! auto fn = [](auto x) { return x; }; using T = decltype(std::not_fn(fn)); - static_assert(std::is_callable::value, ""); - static_assert(!std::is_callable::value, ""); + static_assert(std::is_invocable::value, ""); + static_assert(!std::is_invocable::value, ""); } } @@ -587,7 +587,7 @@ void call_operator_noexcept_test() } void test_lwg2767() { - // See http://wg21.link/LWG2767 + // See https://cplusplus.github.io/LWG/lwg-defects.html#2767 struct Abstract { virtual void f() const = 0; }; struct Derived : public Abstract { void f() const {} }; struct F { bool operator()(Abstract&&) { return false; } }; diff --git a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp index fa7afb2e7b9c..93463190374e 100644 --- a/test/std/utilities/function.objects/func.require/binary_function.pass.cpp +++ b/test/std/utilities/function.objects/func.require/binary_function.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 +// binary_function was removed in C++17 // binary_function diff --git a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp index f14b2d3a2ce5..40a9d480b183 100644 --- a/test/std/utilities/function.objects/func.require/unary_function.pass.cpp +++ b/test/std/utilities/function.objects/func.require/unary_function.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 +// unary_function was removed in C++17 // unary_function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp index 812f6fc502d9..7d3a5dec4ef6 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03 -// REQUIRES: c++11 || c++14 // @@ -25,5 +24,7 @@ struct S : public std::function { using function::function; }; int main() { S s( [](){} ); S f1( s ); +#if TEST_STD_VER <= 14 S f2(std::allocator_arg, std::allocator{}, s); +#endif } diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp index 24f7fceb877b..b23153465168 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp @@ -25,5 +25,5 @@ void foo(int) {} int main() { - std::function f(std::allocator_arg, std::allocator(), foo); + std::function f(std::allocator_arg, std::allocator(), foo); } diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp index 4c1a1ca95ff4..8a2a12e0f789 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 ||c++14 +// REQUIRES: c++98 || c++03 || c++11 || c++14 // class function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp index 9967457ff821..2e4633b11693 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp @@ -24,7 +24,7 @@ int main() { - typedef std::function F; - F f1; - F f2(std::allocator_arg, std::allocator(), f1); + typedef std::function F; + F f1; + F f2(std::allocator_arg, std::allocator(), f1); } diff --git a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp index 00e513ec546f..d64c02f97cd4 100644 --- a/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp +++ b/test/std/utilities/function.objects/logical.operations/transparent.pass.cpp @@ -11,15 +11,15 @@ #include #include -template +template struct is_transparent { private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); + struct two {char lx; char lxx;}; + template static two test(...); + template static char test(typename U::is_transparent* = 0); public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; + static const bool value = sizeof(test(0)) == 1; }; diff --git a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp index df0b55a5d060..fede2538a851 100644 --- a/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp +++ b/test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp @@ -17,7 +17,6 @@ #include class functor1 - : public std::unary_function { }; diff --git a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp index 122716a23a8b..ba3c71e48260 100644 --- a/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp +++ b/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp @@ -17,7 +17,6 @@ #include class functor1 - : public std::unary_function { }; diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp index 721a442d4431..d9f05b4e57a9 100644 --- a/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp +++ b/test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp @@ -17,7 +17,6 @@ #include class functor1 - : public std::unary_function { }; diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp index 564a3f77433c..d0dabd2643e5 100644 --- a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp +++ b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp @@ -17,7 +17,6 @@ #include class functor1 - : public std::unary_function { }; diff --git a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp index 609094dae406..7ce4c846e923 100644 --- a/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp +++ b/test/std/utilities/function.objects/refwrap/weak_result.pass.cpp @@ -16,27 +16,42 @@ #include #include +template +struct my_unary_function +{ // std::unary_function was removed in C++17 + typedef Arg argument_type; + typedef Result result_type; +}; + +template +struct my_binary_function +{ // std::binary_function was removed in C++17 + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; + class functor1 - : public std::unary_function + : public my_unary_function { }; class functor2 - : public std::binary_function + : public my_binary_function { }; class functor3 - : public std::unary_function, - public std::binary_function + : public my_unary_function, + public my_binary_function { public: typedef float result_type; }; class functor4 - : public std::unary_function, - public std::binary_function + : public my_unary_function, + public my_binary_function { public: }; diff --git a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp index ed173f280d05..7b427b9ac1e4 100644 --- a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp @@ -13,7 +13,7 @@ // Hashing a struct w/o a defined hash should *not* fail, but it should // create a type that is not constructible and not callable. -// See also: http://cplusplus.github.io/LWG/lwg-active.html#2543 +// See also: https://cplusplus.github.io/LWG/lwg-defects.html#2543 #include #include @@ -32,7 +32,7 @@ int main() static_assert(!std::is_copy_assignable::value, ""); static_assert(!std::is_move_assignable::value, ""); #if TEST_STD_VER > 14 - static_assert(!std::is_callable::value, ""); - static_assert(!std::is_callable::value, ""); + static_assert(!std::is_invocable::value, ""); + static_assert(!std::is_invocable::value, ""); #endif } diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp index 36280a38e0a7..f1c56aed78b8 100644 --- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -41,7 +41,7 @@ test() assert(h(&i) != h(&j)); } -// can't hash nullptr_t until c++17 +// can't hash nullptr_t until C++17 void test_nullptr() { #if TEST_STD_VER > 14 -- cgit v1.3