From 734ae9d00efa0ec18c1ee58a93b43089e62d035b Mon Sep 17 00:00:00 2001 From: Galo Rojo Date: Sat, 17 Aug 2024 21:44:03 -0800 Subject: [PATCH] Remove some tests which do not pass on GCC versions prior to 14. --- test/source/TestConcepts.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/source/TestConcepts.cpp b/test/source/TestConcepts.cpp index c2dfde90..449eafb1 100644 --- a/test/source/TestConcepts.cpp +++ b/test/source/TestConcepts.cpp @@ -13,6 +13,19 @@ struct NoExceptFalseDestructor ~NoExceptFalseDestructor() noexcept(false) = default; }; +// In GCC prior to version 14, the following static_assert fails: +// +// static_assert(!noexcept(std::declval().~NoExceptFalseDestructor()), "bad noexcept!"); +// +// our implementation of some of these concepts depends on that working correctly so we don't +// do these tests in older versions of GCC. Clang handles this properly and on MSVC we use +// __is_nothrow_destructible instead of rolling our own. +#if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION <= 14000) + #define EA_TEST_NoExceptFalseDestructor 0 +#else + #define EA_TEST_NoExceptFalseDestructor 1 +#endif + struct From; struct To @@ -54,7 +67,9 @@ int TestConcepts() { static_assert(internal::concepts::destructible, "destructible concept failure."); static_assert(!internal::concepts::destructible, "destructible concept failure."); +#if EA_TEST_NoExceptFalseDestructor static_assert(!internal::concepts::destructible, "destructible concept failure."); +#endif } // constructible_from @@ -67,8 +82,10 @@ int TestConcepts() static_assert(!internal::concepts::constructible_from, "constructible_from concept failure."); static_assert(!internal::concepts::constructible_from, "constructible_from concept failure."); static_assert(!internal::concepts::constructible_from, "constructible_from concept failure."); +#if EA_TEST_NoExceptFalseDestructor static_assert(!internal::concepts::constructible_from, "constructible_from concept failure."); static_assert(!internal::concepts::constructible_from, "constructible_from concept failure."); +#endif } // constructible_to @@ -88,7 +105,9 @@ int TestConcepts() static_assert(internal::concepts::move_constructible, "move_constructible concept failure."); static_assert(internal::concepts::move_constructible>, "move_constructible concept failure."); +#if EA_TEST_NoExceptFalseDestructor static_assert(!internal::concepts::move_constructible, "move_constructible concept failure."); +#endif static_assert(!internal::concepts::move_constructible, "move_constructible concept failure."); } @@ -97,7 +116,9 @@ int TestConcepts() static_assert(internal::concepts::copy_constructible, "copy_constructible concept failure."); static_assert(!internal::concepts::copy_constructible>, "copy_constructible concept failure."); +#if EA_TEST_NoExceptFalseDestructor static_assert(!internal::concepts::move_constructible, "copy_constructible concept failure."); +#endif static_assert(!internal::concepts::move_constructible, "copy_constructible concept failure."); }