diff --git a/include/pybind11/detail/smart_holder_poc.h b/include/pybind11/detail/smart_holder_poc.h index 658657dc5..d9eda2f77 100644 --- a/include/pybind11/detail/smart_holder_poc.h +++ b/include/pybind11/detail/smart_holder_poc.h @@ -335,6 +335,7 @@ struct smart_holder { return hld; } +#ifdef PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP template > std::unique_ptr as_unique_ptr() { static const char *context = "as_unique_ptr"; @@ -344,6 +345,7 @@ struct smart_holder { release_ownership(); return std::unique_ptr(raw_ptr); } +#endif template static smart_holder from_shared_ptr(std::shared_ptr shd_ptr) { diff --git a/tests/pure_cpp/smart_holder_poc_test.cpp b/tests/pure_cpp/smart_holder_poc_test.cpp index 1eaef9009..f820b9bf6 100644 --- a/tests/pure_cpp/smart_holder_poc_test.cpp +++ b/tests/pure_cpp/smart_holder_poc_test.cpp @@ -1,3 +1,5 @@ +#define PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP + #include "pybind11/detail/smart_holder_poc.h" #include