I have an overloaded constructor in C++ (default + other). My automatically generated pybind code looks like this:
py::class_<MyClass>(m, "MyClass")
.def(
py::init<>(),
py::kw_only()
)
.def(
py::init<
std::valarray<std::string>
>(),
py::kw_only(),
py::arg("my_var")
)
When I delete the first constructor everything works fine. But for the first one I get this error:
error: static assertion failed: py::kw_only requires the use of argument annotations
static_assert(has_arg_annotations || !has_kw_only_args,
"py::kw_only requires the use of argument annotations"
Does anyone know why this error is coming up and how to fix it?
Edit: I am using a custom pybind generator.