Support for constexpr matchers in C++20 (P0784)

To make this all work, I had to remove the stringification cache
from matchers. In theory, this can cause performance penalty in
cases where single matcher instance is stringified multiple times,
but in practice this does not happen much, and the difference is
surprisingly small anyway, because the performance of stringification
is already horrible and full of allocating strings just to throw
them away.

The matcher combinators need P2738 from C++26 to be `constexpr`.

Closes #3091
This commit is contained in:
Martin Hořeňovský committed 2026-05-12 11:05:02 +02:00
1 parent 15b9393f0f
commit 651247c7f4
14 files changed
+254 -49

No files matched your search

+2
View File
@@ -53,6 +53,8 @@ TEST_CASE( "Disabled Macros" ) {
REQUIRE_THAT( 1,
Catch::Matchers::Predicate( []( int ) { return false; } ) );
BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); };
STATIC_REQUIRE_THAT( 1, Catch::Matchers::Predicate( []( int ) { return false; } ) );
}
struct DisabledFixture {};