Disable <=> tests when <compare> isn't available

This commit is contained in:
Peter Dimov
2025-01-29 04:15:17 +02:00
parent 84d0f84c9b
commit 9b508e3ad2
2 changed files with 22 additions and 0 deletions

View File

@ -8,6 +8,12 @@
#include <boost/config/pragma_message.hpp>
#include <cstddef>
#if defined(__has_include)
# if __has_include(<compare>)
# define HAS_COMPARE
# endif
#endif
#if !defined(__cpp_impl_three_way_comparison)
BOOST_PRAGMA_MESSAGE( "Test skipped because __cpp_impl_three_way_comparison is not defined" )
@ -18,6 +24,11 @@ int main() {}
BOOST_PRAGMA_MESSAGE( "Test skipped because __cpp_impl_three_way_comparison is defined to " BOOST_STRINGIZE(__cpp_impl_three_way_comparison) )
int main() {}
#elif !defined(HAS_COMPARE)
BOOST_PRAGMA_MESSAGE( "Test skipped because <compare> is not available" )
int main() {}
#else
template<class T, std::size_t N> void test()

View File

@ -8,6 +8,12 @@
#include <boost/config/workaround.hpp>
#include <cstddef>
#if defined(__has_include)
# if __has_include(<compare>)
# define HAS_COMPARE
# endif
#endif
#if !defined(__cpp_impl_three_way_comparison)
BOOST_PRAGMA_MESSAGE( "Test skipped because __cpp_impl_three_way_comparison is not defined" )
@ -18,6 +24,11 @@ int main() {}
BOOST_PRAGMA_MESSAGE( "Test skipped because __cpp_impl_three_way_comparison is defined to " BOOST_STRINGIZE(__cpp_impl_three_way_comparison) )
int main() {}
#elif !defined(HAS_COMPARE)
BOOST_PRAGMA_MESSAGE( "Test skipped because <compare> is not available" )
int main() {}
#else
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)