diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index 9c60c94c04..cee4ab5623 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -1039,11 +1039,11 @@ class accessor : public object_api> { void operator=(const accessor &a) & { operator=(handle(a)); } template - void operator=(T &&value) && { + enable_if_t>::value> operator=(T &&value) && { Policy::set(obj, key, object_or_cast(std::forward(value))); } template - void operator=(T &&value) & { + enable_if_t>::value> operator=(T &&value) & { get_cache() = ensure_object(object_or_cast(std::forward(value))); }