diff --git a/tests/test_type_caster_odr_guard_1.cpp b/tests/test_type_caster_odr_guard_1.cpp index b155eb875b..fbd7bd5bc8 100644 --- a/tests/test_type_caster_odr_guard_1.cpp +++ b/tests/test_type_caster_odr_guard_1.cpp @@ -75,4 +75,11 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) { // See comment near the bottom of test_type_caster_odr_guard_2.cpp. m.def("pass_vector_type_mrc", mrc_ns::pass_vector_type_mrc); + + m.attr("ifdef__NO_INLINE__") = +#ifdef __NO_INLINE__ + true; +#else + false; +#endif } diff --git a/tests/test_type_caster_odr_guard_1.py b/tests/test_type_caster_odr_guard_1.py index ef669a2829..9fb8021593 100644 --- a/tests/test_type_caster_odr_guard_1.py +++ b/tests/test_type_caster_odr_guard_1.py @@ -36,11 +36,9 @@ def test_type_caster_odr_violation_detected_counter(): num_violations = m.type_caster_odr_violation_detected_count() if num_violations is None: pytest.skip("type_caster_odr_violation_detected_count() is None") - elif num_violations == 0 and ( - pybind11_tests.compiler_info == "9.4.0" # Debug build known to not work. - ): + elif num_violations == 0 and m.ifdef__NO_INLINE__: pytest.skip( - "UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)" + "type_caster_odr_violation_detected_count() == 0: %s, %s, __NO_INLINE__" % (pybind11_tests.compiler_info, pybind11_tests.cpp_std) ) else: