diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 8cccd4c3..05b2b9e2 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -929,7 +929,9 @@ public: } template class_ & - def_static(const char *name_, Func f, const Extra&... extra) { + def_static(const char *name_, Func &&f, const Extra&... extra) { + static_assert(!std::is_member_function_pointer::value, + "def_static(...) called with a non-static member function pointer"); cpp_function cf(std::forward(f), name(name_), scope(*this), sibling(getattr(*this, name_, none())), extra...); attr(cf.name()) = cf;