Skip to content

Commit 6da8b5a

Browse files
committed
Fix is_invocable_v and add test coverage
1 parent 454b8ad commit 6da8b5a

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

include/boost/callable_traits/is_invocable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ BOOST_CLBL_TRAITS_INLINE_VAR
6767
//->
6868
constexpr bool is_invocable_v = //see below
6969
//<-
70-
detail::is_invocable_impl<detail::traits<T>, Args...>::type::value;
70+
detail::is_invocable_impl<T, Args...>::type::value;
7171
//->
7272

7373
// only available when variable templates are supported

test/is_invocable.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ struct invoke_case {
2828
// when available, test parity with std implementation (c++2a breaks our expectations but we still match std impl)
2929
#if defined(__cpp_lib_is_invocable) || __cplusplus >= 201707L
3030
CT_ASSERT((std::is_invocable<Callable, Args...>() == boost::callable_traits::is_invocable<Callable, Args...>()));
31+
# ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
32+
CT_ASSERT((std::is_invocable_v<Callable, Args...> == boost::callable_traits::is_invocable_v<Callable, Args...>));
33+
# endif
3134
#else
3235
CT_ASSERT((Expect == boost::callable_traits::is_invocable<Callable, Args...>()));
36+
# ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
37+
CT_ASSERT((Expect == boost::callable_traits::is_invocable_v<Callable, Args...>));
38+
# endif
3339
#endif
3440

3541
}

test/is_invocable_r.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ struct invoke_case {
2828
// when available, test parity with std implementation (c++2a breaks our expectations but we still match std impl)
2929
#if defined(__cpp_lib_is_invocable) || __cplusplus >= 201707L
3030
CT_ASSERT((std::is_invocable_r<Ret, Callable, Args...>() == boost::callable_traits::is_invocable_r<Ret, Callable, Args...>()));
31+
# ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
32+
CT_ASSERT((std::is_invocable_r_v<Ret, Callable, Args...> == boost::callable_traits::is_invocable_r_v<Ret, Callable, Args...>));
33+
# endif
3134
#else
3235
CT_ASSERT((Expect == boost::callable_traits::is_invocable_r<Ret, Callable, Args...>()));
36+
# ifndef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES
37+
CT_ASSERT((Expect == boost::callable_traits::is_invocable_r_v<Ret, Callable, Args...>));
38+
# endif
3339
#endif
3440

3541
}

0 commit comments

Comments
 (0)