From 20ef96c87db22534730ed627a21496509fbd3ba5 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 19 Jun 2021 18:24:36 -0700 Subject: [PATCH] Disabling debugging call of `weak_from_this` for C++ < 17. --- include/pybind11/detail/smart_holder_poc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/pybind11/detail/smart_holder_poc.h b/include/pybind11/detail/smart_holder_poc.h index abb87827f..e83737e7b 100644 --- a/include/pybind11/detail/smart_holder_poc.h +++ b/include/pybind11/detail/smart_holder_poc.h @@ -64,8 +64,11 @@ 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) if (ptr->weak_from_this().lock()) return 1; return -1; +#endif + return 999; } struct smart_holder;