diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index a2040ad860..162e1884e3 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1335,8 +1335,7 @@ object object_or_cast(T &&o) { template template str_attr_accessor object_api::attr_with_type(const char *key) const { - static constexpr auto name = make_caster::name; - annotations()[key] = name.text; + annotations()[key] = make_caster::name.text; return {derived(), key}; } #endif