diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 77297c454..360df6b5a 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -517,11 +517,11 @@ struct smart_holder_type_caster> : smart_holder_type_caster_l // MISSING: keep_alive. return existing_inst.second; - object inst = reinterpret_steal(make_new_instance(tinfo->type)); - instance *inst_raw_ptr = reinterpret_cast(inst.ptr()); - inst_raw_ptr->owned = true; - void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); - valueptr = src_raw_void_ptr; + auto inst = reinterpret_steal(make_new_instance(tinfo->type)); + auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); + inst_raw_ptr->owned = true; + void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); + valueptr = src_raw_void_ptr; auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(src); tinfo->init_instance(inst_raw_ptr, static_cast(&smhldr)); @@ -578,11 +578,11 @@ struct smart_holder_type_caster> : smart_holder_type_caster_l if (existing_inst.first) throw cast_error("Invalid unique_ptr: another instance owns this pointer already."); - object inst = reinterpret_steal(make_new_instance(tinfo->type)); - instance *inst_raw_ptr = reinterpret_cast(inst.ptr()); - inst_raw_ptr->owned = true; - void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); - valueptr = src_raw_void_ptr; + auto inst = reinterpret_steal(make_new_instance(tinfo->type)); + auto *inst_raw_ptr = reinterpret_cast(inst.ptr()); + inst_raw_ptr->owned = true; + void *&valueptr = values_and_holders(inst_raw_ptr).begin()->value_ptr(); + valueptr = src_raw_void_ptr; auto smhldr = pybindit::memory::smart_holder::from_unique_ptr(std::move(src)); tinfo->init_instance(inst_raw_ptr, static_cast(&smhldr));