diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index b66129688..e3a061444 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -372,7 +372,7 @@ struct variant_caster> { bool load_alternative(handle src, bool convert, type_list) { auto caster = make_caster(); if (caster.load(src, convert)) { - value = cast_op(caster); + value = cast_op(std::move(caster)); return true; } return load_alternative(src, convert, type_list{});