diff options
Diffstat (limited to 'lib/util.cpp')
-rw-r--r-- | lib/util.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/util.cpp b/lib/util.cpp index 4c176fc7..5e7644a1 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -100,10 +100,16 @@ struct S { int mf(); }; static_assert(is_callable_v<decltype(&S::mf)>, "Test member function"); static_assert(returns<int, decltype(&S::mf)>(), "Test returns<> with member function"); -struct Fo { void operator()(int); }; -static_assert(function_traits<Fo>::arg_number == 1, "Test function object 1"); -static_assert(is_callable_v<Fo>, "Test is_callable<>"); -static_assert(std::is_same<fn_arg_t<Fo>, int>(), +struct Fo { int operator()(); }; +static_assert(is_callable_v<Fo>, "Test is_callable<> with function object"); +static_assert(function_traits<Fo>::arg_number == 0, "Test function object"); +static_assert(std::is_same<fn_return_t<Fo>, int>::value, + "Test return type of function object"); + +struct Fo1 { void operator()(int); }; +static_assert(function_traits<Fo1>::arg_number == 1, "Test function object 1"); +static_assert(is_callable_v<Fo1>, "Test is_callable<> with function object 1"); +static_assert(std::is_same<fn_arg_t<Fo1>, int>(), "Test fn_arg_t defaulting to first argument"); static auto l = [] { return 1; }; |