Skip to content

Commit 442cc3b

Browse files
committed
Another attempt at fixing old compilers with partial C++20 support
1 parent acb201d commit 442cc3b

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/catch2/internal/catch_compiler_capabilities.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
#endif
3737

3838
// Matchers are only constexpr-able in C++20
39-
#if defined( CATCH_CPP20_OR_GREATER )
39+
#if defined( CATCH_CPP20_OR_GREATER ) && \
40+
defined( __cpp_constexpr_dynamic_alloc ) && \
41+
__cpp_constexpr_dynamic_alloc >= 201907L
42+
# define CATCH_INTERNAL_CONSTEXPR_MATCHERS_ENABLED
4043
# define CATCH_CPP20_CONSTEXPR constexpr
4144
#else
4245
# define CATCH_CPP20_CONSTEXPR

tests/SelfTest/UsageTests/MatchersConstexpr.tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <catch2/catch_test_macros.hpp>
1010
#include <catch2/matchers/catch_matchers_templated.hpp>
1111

12-
#if defined(CATCH_CPP20_OR_GREATER)
12+
#if defined( CATCH_INTERNAL_CONSTEXPR_MATCHERS_ENABLED )
1313

1414
namespace {
1515
struct MatchAllMatcher final : public Catch::Matchers::MatcherGenericBase {

0 commit comments

Comments
 (0)