From 993613d9bf230bf38b5ed66f4222fd6af05c513c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 19 Jun 2021 18:33:02 -0700 Subject: [PATCH] Trying again, to get around unused parameter warnings-as-erros. --- include/pybind11/detail/smart_holder_poc.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/smart_holder_poc.h b/include/pybind11/detail/smart_holder_poc.h index e83737e7b..0629ab696 100644 --- a/include/pybind11/detail/smart_holder_poc.h +++ b/include/pybind11/detail/smart_holder_poc.h @@ -63,13 +63,16 @@ namespace memory { inline int shared_from_this_status(...) { return 0; } template -inline int shared_from_this_status(const std::enable_shared_from_this *ptr) { #if defined(__cpp_lib_enable_shared_from_this) && (!defined(_MSC_VER) || _MSC_VER >= 1912) +inline int shared_from_this_status(const std::enable_shared_from_this *ptr) { if (ptr->weak_from_this().lock()) return 1; return -1; -#endif +} +#else +inline int shared_from_this_status(const std::enable_shared_from_this *) { return 999; } +#endif struct smart_holder;