diff --git a/include/pybind11/detail/type_caster_odr_guard.h b/include/pybind11/detail/type_caster_odr_guard.h index 03e1c9467..ede37337d 100644 --- a/include/pybind11/detail/type_caster_odr_guard.h +++ b/include/pybind11/detail/type_caster_odr_guard.h @@ -18,7 +18,8 @@ #else -# if defined(__GNUC__) && !defined(PYBIND11_CPP20) +# if !defined(PYBIND11_CPP20) && defined(__GNUC__) && !defined(__clang__) \ + && !defined(__INTEL_COMPILER) # pragma GCC diagnostic ignored "-Wsubobject-linkage" # endif