diff --git a/include/pybind11/detail/type_caster_odr_guard.h b/include/pybind11/detail/type_caster_odr_guard.h index 08bc78575..03e1c9467 100644 --- a/include/pybind11/detail/type_caster_odr_guard.h +++ b/include/pybind11/detail/type_caster_odr_guard.h @@ -6,7 +6,7 @@ #if !defined(PYBIND11_TYPE_CASTER_ODR_GUARD_ON) && !defined(PYBIND11_TYPE_CASTER_ODR_GUARD_OFF) \ && (defined(_MSC_VER) || defined(PYBIND11_CPP20) \ - || (defined(PYBIND11_CPP17) && defined(__clang__))) + || (defined(PYBIND11_CPP17) /* && defined(__clang__)*/)) # define PYBIND11_TYPE_CASTER_ODR_GUARD_ON #endif @@ -18,6 +18,10 @@ #else +# if defined(__GNUC__) && !defined(PYBIND11_CPP20) +# pragma GCC diagnostic ignored "-Wsubobject-linkage" +# endif + # include "common.h" # include "descr.h" # include "typeid.h"