Skip to content

Commit c4b9d10

Browse files
committed
Move C++20 detection to detail/config.hpp; disable C++20 use for Clang < 13.
1 parent b1b31d4 commit c4b9d10

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

include/boost/describe/detail/config.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,20 @@
4545

4646
#define BOOST_DESCRIBE_INLINE_CONSTEXPR BOOST_DESCRIBE_INLINE_VARIABLE BOOST_DESCRIBE_CONSTEXPR_OR_CONST
4747

48+
#if __cplusplus >= 202002L || ( defined(_MSVC_LANG) && _MSVC_LANG >= 202002L )
49+
50+
# define BOOST_DESCRIBE_CXX20
51+
52+
// Clang 13.0 is needed for unevaluated lambdas
53+
# if defined(__clang__) && __clang_major__ < 13
54+
# undef BOOST_DESCRIBE_CXX20
55+
# endif
56+
57+
// Apple Clang 13.1 is Clang 13.0
58+
# if defined(__clang__) && defined(__apple_build_version__) && __clang_major__ == 13 && __clang_minor__ < 1
59+
# undef BOOST_DESCRIBE_CXX20
60+
# endif
61+
62+
#endif
63+
4864
#endif // #ifndef BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED

include/boost/describe/enum.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ template<class... T> auto enum_descriptor_fn_impl( int, T... )
4343
return list<enum_descriptor<T>...>();
4444
}
4545

46-
#if __cplusplus >= 202002L || ( defined(_MSVC_LANG) && _MSVC_LANG >= 202002L )
46+
#if defined(BOOST_DESCRIBE_CXX20)
4747

4848
template<auto V, auto N> struct enum_desc
4949
{

test/nested_enum_test2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <boost/config.hpp>
88
#include <boost/config/pragma_message.hpp>
99

10-
#if BOOST_CXX_VERSION < 202002L
10+
#if !defined(BOOST_DESCRIBE_CXX20)
1111

12-
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_CXX_VERSION < 202002L")
12+
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_DESCRIBE_CXX20 isn't defined")
1313

1414
#else
1515

0 commit comments

Comments
 (0)