Move C++20 detection to detail/config.hpp; disable C++20 use for Clang < 13.

This commit is contained in:
Peter Dimov
2025-11-14 22:40:43 +02:00
parent 644a984a61
commit 0a40d3b824
3 changed files with 19 additions and 3 deletions

View File

@@ -45,4 +45,20 @@
#define BOOST_DESCRIBE_INLINE_CONSTEXPR BOOST_DESCRIBE_INLINE_VARIABLE BOOST_DESCRIBE_CONSTEXPR_OR_CONST
#if __cplusplus >= 202002L || ( defined(_MSVC_LANG) && _MSVC_LANG >= 202002L )
# define BOOST_DESCRIBE_CXX20
// Clang 13.0 is needed for unevaluated lambdas
# if defined(__clang__) && __clang_major__ < 13
# undef BOOST_DESCRIBE_CXX20
# endif
// Apple Clang 13.1 is Clang 13.0
# if defined(__clang__) && defined(__apple_build_version__) && __clang_major__ == 13 && __clang_minor__ < 1
# undef BOOST_DESCRIBE_CXX20
# endif
#endif
#endif // #ifndef BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED

View File

@@ -43,7 +43,7 @@ template<class... T> auto enum_descriptor_fn_impl( int, T... )
return list<enum_descriptor<T>...>();
}
#if __cplusplus >= 202002L || ( defined(_MSVC_LANG) && _MSVC_LANG >= 202002L )
#if defined(BOOST_DESCRIBE_CXX20)
template<auto V, auto N> struct enum_desc
{

View File

@@ -7,9 +7,9 @@
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if BOOST_CXX_VERSION < 202002L
#if !defined(BOOST_DESCRIBE_CXX20)
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_CXX_VERSION < 202002L")
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_DESCRIBE_CXX20 isn't defined")
#else