boostorg/callable_traits

is_invocable is broken for operator() without parameters

Closed this issue · 2 comments

is_invocable fails to recognize lambdas without parameters as well as ordinary function objects with an operator() without parameters. Live demo is on Godbolt.

Example, the first two assertions fail, the std version succeeds:

#include <type_traits>
#include <boost/callable_traits/is_invocable.hpp>

struct Foo {
    void operator()() {
    }
};

int main() {
    auto f = []() { };

    static_assert(boost::callable_traits::is_invocable<Foo>::value);
    static_assert(boost::callable_traits::is_invocable<decltype(f)>::value);
    static_assert(std::is_invocable<Foo>::value);
    static_assert(std::is_invocable<decltype(f)>::value);
}

Thanks Peter, I will update when this is fixed.

Fixed via 2f2497b. Should make it into Boost 1.70.