diff options
author | Zhihao Yuan <zy@miator.net> | 2017-12-12 18:42:04 +0000 |
---|---|---|
committer | Zhihao Yuan <zy@miator.net> | 2017-12-12 18:42:04 +0000 |
commit | bcde6e715ef0fd2ae3e092b4104cc9c79bd73cf6 (patch) | |
tree | e80680d1b6be5c2976c2770b63c31fd0ca0d6441 /libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp | |
parent | 81a4a02cbc02143576275dbc6807b9b99c18961e (diff) | |
download | bcm5719-llvm-bcde6e715ef0fd2ae3e092b4104cc9c79bd73cf6.tar.gz bcm5719-llvm-bcde6e715ef0fd2ae3e092b4104cc9c79bd73cf6.zip |
[libcxx] P0604, invoke_result and is_invocable
Summary:
Introduce a new form of `result_of` without function type encoding.
Rename and split `is_callable/is_nothrow_callable` into `is_invocable/is_nothrow_invocable/is_invocable_r/is_nothrow_invocable_r` (and associated types accordingly)
Change function type encoding of previous `is_callable/is_nothrow_callable` traits to conventional template type parameter lists.
Reviewers: EricWF, mclow.lists, bebuch
Reviewed By: EricWF, bebuch
Subscribers: lichray, bebuch, cfe-commits
Differential Revision: https://reviews.llvm.org/D38831
llvm-svn: 320509
Diffstat (limited to 'libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index 1543f3da7d8..7601ff9d147 100644 --- a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/libcxx/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, ""); } } |