From 6689b06449c3d7b716ee71a834b9bb0d035d1dac Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 9 Oct 2023 11:05:07 -0700 Subject: [PATCH] Move PYBIND11_CONSTINIT to detail/common.h --- include/pybind11/detail/common.h | 8 ++++++++ include/pybind11/numpy.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index e79f7693d0..9adf73acad 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -118,6 +118,14 @@ # endif #endif +#ifndef PYBIND11_CONSTINIT +# ifdef PYBIND11_CPP20 +# define PYBIND11_CONSTINIT constinit +# else +# define PYBIND11_CONSTINIT +# endif +#endif + // Compiler version assertions #if defined(__INTEL_COMPILER) # if __INTEL_COMPILER < 1800 diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 1c76177f95..7fe6096ab4 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -43,14 +43,6 @@ class array; // Forward declaration PYBIND11_NAMESPACE_BEGIN(detail) -#ifndef PYBIND11_CONSTINIT -# if __cplusplus >= 202002L -# define PYBIND11_CONSTINIT constinit -# else -# define PYBIND11_CONSTINIT -# endif -#endif - // Main author of this class: jbms@ template class LazyInitializeAtLeastOnceDestroyNever {