diff options
| author | Martin Hořeňovský | 2025-10-03 22:17:03 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-10-03 22:27:29 +0200 |
| commit | 8e4ab5dd8f5a9b6fed373c58a9aa07a82e528827 (patch) | |
| tree | 43a504faeb40d95f0f9ddff4117ef2e37e6d64a9 /src/Progmasoft/ChoiceShrinker.cpp | |
| parent | 8219ed79f29420c89748ae5eb8810946cefd491d (diff) | |
| download | catch3-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 'src/Progmasoft/ChoiceShrinker.cpp')
0 files changed, 0 insertions, 0 deletions