Skip to content

Commit baf6b99

Browse files
anntzerwjakob
authored andcommitted
Silence GCC8's -Wcast-function-type. (#1396)
* Silence GCC8's -Wcast-function-type. See https://bugs.python.org/issue33012 and PRs linked therein.
1 parent 97b20e5 commit baf6b99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pybind11/pybind11.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class cpp_function : public function {
306306
rec->def = new PyMethodDef();
307307
std::memset(rec->def, 0, sizeof(PyMethodDef));
308308
rec->def->ml_name = rec->name;
309-
rec->def->ml_meth = reinterpret_cast<PyCFunction>(*dispatcher);
309+
rec->def->ml_meth = reinterpret_cast<PyCFunction>(reinterpret_cast<void (*) (void)>(*dispatcher));
310310
rec->def->ml_flags = METH_VARARGS | METH_KEYWORDS;
311311

312312
capsule rec_capsule(rec, [](void *ptr) {

0 commit comments

Comments
 (0)