diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 6dc2520ce..3a7e982c4 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1385,19 +1385,15 @@ struct smart_holder_type_caster : smart_holder_type_caster_load, using cast_op_type = conditional_t< std::is_same, T const *>::value, T const *, - conditional_t< - std::is_same, T *>::value, - T *, - conditional_t::value, - T const &, - conditional_t::value, - T &, - conditional_t::value, T &&, T>>>>>; + conditional_t, T *>::value, + T *, + conditional_t::value, + T const &, + conditional_t::value, T &, T>>>>; // clang-format off operator T() { return this->loaded_as_lvalue_ref(); } - operator T&&() && { return this->loaded_as_rvalue_ref(); } operator T const&() { return this->loaded_as_lvalue_ref(); } operator T&() { return this->loaded_as_lvalue_ref(); } operator T const*() { return this->loaded_as_raw_ptr_unowned(); } diff --git a/tests/test_class_sh_basic.py b/tests/test_class_sh_basic.py index 7c665e47a..8792c7cb8 100644 --- a/tests/test_class_sh_basic.py +++ b/tests/test_class_sh_basic.py @@ -23,8 +23,8 @@ def test_cast(): def test_load(): - assert m.pass_valu_atyp(m.atyp("Valu")) == "pass_valu:Valu.MvCtor.MvCtor" - assert m.pass_rref_atyp(m.atyp("Rref")) == "pass_rref:Rref.MvCtor" + assert m.pass_valu_atyp(m.atyp("Valu")) == "pass_valu:Valu.MvCtor.CpCtor" + assert m.pass_rref_atyp(m.atyp("Rref")) == "pass_rref:Rref.MvCtor.CpCtor" assert m.pass_cref_atyp(m.atyp("Cref")) == "pass_cref:Cref.MvCtor" assert m.pass_mref_atyp(m.atyp("Mref")) == "pass_mref:Mref.MvCtor" assert m.pass_cptr_atyp(m.atyp("Cptr")) == "pass_cptr:Cptr.MvCtor" diff --git a/tests/test_methods_and_attributes.py b/tests/test_methods_and_attributes.py index 28e9afe3b..2aaf9331f 100644 --- a/tests/test_methods_and_attributes.py +++ b/tests/test_methods_and_attributes.py @@ -62,7 +62,7 @@ def test_methods_and_attributes(): assert cstats.alive() == 0 assert cstats.values() == ["32"] assert cstats.default_constructions == 1 - assert cstats.copy_constructions in (2, 1) # SMART_HOLDER_WIP + assert cstats.copy_constructions == 2 assert cstats.move_constructions >= 2 assert cstats.copy_assignments == 0 assert cstats.move_assignments == 0 diff --git a/tests/test_virtual_functions.py b/tests/test_virtual_functions.py index 4619d5f78..f7d3bd1e4 100644 --- a/tests/test_virtual_functions.py +++ b/tests/test_virtual_functions.py @@ -230,7 +230,7 @@ def test_move_support(): assert nc_stats.values() == ["4", "9", "9", "9"] assert mv_stats.values() == ["4", "5", "7", "7"] assert nc_stats.copy_constructions == 0 - assert mv_stats.copy_constructions in (1, 0) # SMART_HOLDER_WIP + assert mv_stats.copy_constructions == 1 assert nc_stats.move_constructions >= 0 assert mv_stats.move_constructions >= 0