From 89d0ddd6ffb02703e0207719571986daa47ec914 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 20 Jul 2024 19:40:38 -0700 Subject: [PATCH] test_class.cpp: simpler approach, leveraging new `PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT` --- include/pybind11/pybind11.h | 1 + tests/test_class.cpp | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index b7717f69b..1c80c1c00 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1800,6 +1800,7 @@ struct property_cpp_function< #if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \ && defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT) // BAKEIN_WIP: Add comment to explain: This is meant for stress-testing only. +# define PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT template using default_holder_type = smart_holder; #else diff --git a/tests/test_class.cpp b/tests/test_class.cpp index 494a38b81..3f2f23708 100644 --- a/tests/test_class.cpp +++ b/tests/test_class.cpp @@ -607,17 +607,10 @@ CHECK_NOALIAS(8); static_assert(std::is_same>>::value, \ "DoesntBreak" #N " has wrong holder_type!") -#define CHECK_SMART_HOLDER(N) \ - static_assert(std::is_same::value, \ - "DoesntBreak" #N " has wrong holder_type!") CHECK_HOLDER(1, unique); CHECK_HOLDER(2, unique); CHECK_HOLDER(3, unique); -#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \ - && defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT) -CHECK_SMART_HOLDER(4); -CHECK_SMART_HOLDER(5); -#else +#ifndef PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT CHECK_HOLDER(4, unique); CHECK_HOLDER(5, unique); #endif