diff --git a/tests/test_class_sh_shared_from_this.cpp b/tests/test_class_sh_shared_from_this.cpp index 09fdbff12..a021d4e42 100644 --- a/tests/test_class_sh_shared_from_this.cpp +++ b/tests/test_class_sh_shared_from_this.cpp @@ -112,7 +112,9 @@ struct RescuingDeleter { explicit RescuingDeleter(PyWrapper *pyw) : pyw{pyw} {} void operator()(ToBeWrapped *raw_ptr) { if (pyw->self.get() != nullptr) { +#if !defined(_MSC_VER) || _MSC_VER >= 1912 assert(raw_ptr->weak_from_this().expired()); // CRITICAL +#endif pyw->wobj = std::shared_ptr(raw_ptr, *this); pyw->self.reset(); } else {