aboutsummaryrefslogtreecommitdiff
path: root/test/std/utilities/function.objects
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/utilities/function.objects')
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/comparisons/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp18
-rw-r--r--test/std/utilities/function.objects/func.require/binary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.require/unary_function.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp6
-rw-r--r--test/std/utilities/function.objects/logical.operations/transparent.pass.cpp10
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/refwrap/weak_result.pass.cpp27
-rw-r--r--test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/pointer.pass.cpp2
19 files changed, 66 insertions, 50 deletions
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 <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(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 <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(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 <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(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<T()>::value, ""); // callable only with no args
- static_assert(!std::is_callable<T(bool)>::value, "");
+ static_assert(std::is_invocable<T>::value, ""); // callable only with no args
+ static_assert(!std::is_invocable<T, bool>::value, "");
}
{ // violates const correctness (member function pointer)
using T = decltype(std::not_fn(&MemFunCallable::return_value_nc));
- static_assert(std::is_callable<T(MemFunCallable&)>::value, "");
- static_assert(!std::is_callable<T(const MemFunCallable&)>::value, "");
+ static_assert(std::is_invocable<T, MemFunCallable&>::value, "");
+ static_assert(!std::is_invocable<T, const MemFunCallable&>::value, "");
}
{ // violates const correctness (call object)
using Obj = CopyCallable<bool>;
using NCT = decltype(std::not_fn(Obj{true}));
using CT = const NCT;
- static_assert(std::is_callable<NCT()>::value, "");
- static_assert(!std::is_callable<CT()>::value, "");
+ static_assert(std::is_invocable<NCT>::value, "");
+ static_assert(!std::is_invocable<CT>::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<T(bool)>::value, "");
- static_assert(!std::is_callable<T(std::string)>::value, "");
+ static_assert(std::is_invocable<T, bool>::value, "");
+ static_assert(!std::is_invocable<T, std::string>::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 @@
//===----------------------------------------------------------------------===//
// <functional>
+// 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 @@
//===----------------------------------------------------------------------===//
// <functional>
+// 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
// <functional>
@@ -25,5 +24,7 @@ struct S : public std::function<void()> { using function::function; };
int main() {
S s( [](){} );
S f1( s );
+#if TEST_STD_VER <= 14
S f2(std::allocator_arg, std::allocator<int>{}, 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<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
+ std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), 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 @@
//===----------------------------------------------------------------------===//
// <functional>
-// REQUIRES: c++98 || c++03 || c++11 ||c++14
+// REQUIRES: c++98 || c++03 || c++11 || c++14
// class function<R(ArgTypes...)>
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<void(int)> F;
- F f1;
- F f2(std::allocator_arg, std::allocator<int>(), f1);
+ typedef std::function<void(int)> F;
+ F f1;
+ F f2(std::allocator_arg, std::allocator<int>(), 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 <functional>
#include <string>
-template <class _Tp>
+template <class T>
struct is_transparent
{
private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
+ struct two {char lx; char lxx;};
+ template <class U> static two test(...);
+ template <class U> static char test(typename U::is_transparent* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ static const bool value = sizeof(test<T>(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 <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
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 <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
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 <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
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 <cassert>
class functor1
- : public std::unary_function<int, char>
{
};
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 <functional>
#include <type_traits>
+template <class Arg, class Result>
+struct my_unary_function
+{ // std::unary_function was removed in C++17
+ typedef Arg argument_type;
+ typedef Result result_type;
+};
+
+template <class Arg1, class Arg2, class Result>
+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<int, char>
+ : public my_unary_function<int, char>
{
};
class functor2
- : public std::binary_function<char, int, double>
+ : public my_binary_function<char, int, double>
{
};
class functor3
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
- : public std::unary_function<char, int>,
- public std::binary_function<char, int, double>
+ : public my_unary_function<char, int>,
+ public my_binary_function<char, int, double>
{
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 <functional>
#include <cassert>
@@ -32,7 +32,7 @@ int main()
static_assert(!std::is_copy_assignable<H>::value, "");
static_assert(!std::is_move_assignable<H>::value, "");
#if TEST_STD_VER > 14
- static_assert(!std::is_callable<H(X&)>::value, "");
- static_assert(!std::is_callable<H(X const&)>::value, "");
+ static_assert(!std::is_invocable<H, X&>::value, "");
+ static_assert(!std::is_invocable<H, X const&>::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