From cb562337448afa07b056c8934ebef0ac19a9ca5e Mon Sep 17 00:00:00 2001 From: James Morris Date: Tue, 26 Nov 2024 20:31:03 -0500 Subject: [PATCH] fix: Avoid -Wgnu-zero-variadic-macro-arguments in C++20 on clang --- include/pybind11/cast.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 2ae25c2ebf..bb6ac6719a 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -868,12 +868,19 @@ struct always_construct_holder { static constexpr bool value = Value; }; +// Avoid -Wgnu-zero-variadic-macro-arguments in C++20 on clang +#ifdef PYBIND11_CPP20 + #define PYBIND11_DECLARE_HOLDER_TYPE_ARGS(...) void __VA_OPT__(,) __VA_ARGS__ +#else + #define PYBIND11_DECLARE_HOLDER_TYPE_ARGS(...) void, ##__VA_ARGS__ +#endif + /// Create a specialization for custom holder types (silently ignores std::shared_ptr) #define PYBIND11_DECLARE_HOLDER_TYPE(type, holder_type, ...) \ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) \ namespace detail { \ template \ - struct always_construct_holder : always_construct_holder { \ + struct always_construct_holder : always_construct_holder { \ }; \ template \ class type_caster::value>> \