Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests/Compilation.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2025-10-03 22:17:03 +0200
committerMartin Hořeňovský2025-10-03 22:27:29 +0200
commit8e4ab5dd8f5a9b6fed373c58a9aa07a82e528827 (patch)
tree43a504faeb40d95f0f9ddff4117ef2e37e6d64a9 /tests/SelfTest/UsageTests/Compilation.tests.cpp
parent8219ed79f29420c89748ae5eb8810946cefd491d (diff)
downloadcatch3-8e4ab5dd8f5a9b6fed373c58a9aa07a82e528827.tar.gz
Annotate matcher combinators with CATCH_ATTR_LIFETIMEBOUND
The matcher combinators do not take ownership of the matchers being combined, which can catch the users off-guard, when code like this ```cpp using Catch::Matchers::EndsWith; using Catch::Matchers::ContainsSubstring; auto combinedMatcher = EndsWith("as a service") && ContainsSubstring("web scale"); REQUIRE_THAT( getSomeString(), combinedMatcher ); ``` leads to use-after-free, as the `combinedMatcher` refers to matcher temporaries that no longer exists. With this commit, users of Clang, MSVC or other compiler that understands the `lifetimebound` attribute, should get a warning.
Diffstat (limited to 'tests/SelfTest/UsageTests/Compilation.tests.cpp')
0 files changed, 0 insertions, 0 deletions