diff --git a/pybind11_protobuf/proto_caster_impl.h b/pybind11_protobuf/proto_caster_impl.h index e10c0d1..12e693d 100644 --- a/pybind11_protobuf/proto_caster_impl.h +++ b/pybind11_protobuf/proto_caster_impl.h @@ -55,7 +55,7 @@ struct proto_caster_load_impl { const ::google::protobuf::Message *message = pybind11_protobuf::PyProtoGetCppMessagePointer(src); if (message) { - value = dynamic_cast(message); + value = ::google::protobuf::DynamicCastToGenerated(message); if (value) { // If the capability were available, then we could probe PyProto_API and // allow c++ mutability based on the python reference count.