File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")
4343# include < cxxabi.h>
4444#endif
4545
46+ #if defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606
47+ #define PYBIND11_MYABE_CONSTEXPR constexpr
48+ #else
49+ #define PYBIND11_MYABE_CONSTEXPR
50+ #endif
51+
4652PYBIND11_NAMESPACE_BEGIN (PYBIND11_NAMESPACE)
4753
4854/* https://stackoverflow.com/questions/46798456/handling-gccs-noexcept-type-warning
@@ -3606,7 +3612,8 @@ function get_override(const T *this_ptr, const char *name) {
36063612 auto o = override (__VA_ARGS__); \
36073613 PYBIND11_WARNING_PUSH \
36083614 PYBIND11_WARNING_DISABLE_MSVC (4127 ) \
3609- if (pybind11::detail::cast_is_temporary_value_reference<ret_type>::value \
3615+ if PYBIND11_MYABE_CONSTEXPR \
3616+ (pybind11::detail::cast_is_temporary_value_reference<ret_type>::value \
36103617 && !pybind11::detail::is_same_ignoring_cvref<ret_type, PyObject *>::value) { \
36113618 static pybind11::detail::override_caster_t <ret_type> caster; \
36123619 return pybind11::detail::cast_ref<ret_type>(std::move (o), caster); \
You can’t perform that action at this time.
0 commit comments