Forbid deducing reference types for m_predicate in FilterGenerator#3005
Merged
horenmar merged 2 commits intocatchorg:develfrom Aug 23, 2025
Merged
Forbid deducing reference types for m_predicate in FilterGenerator#3005horenmar merged 2 commits intocatchorg:develfrom
horenmar merged 2 commits intocatchorg:develfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #3005 +/- ##
==========================================
- Coverage 90.97% 90.93% -0.03%
==========================================
Files 201 201
Lines 8681 8681
==========================================
- Hits 7897 7894 -3
- Misses 784 787 +3 🚀 New features to boost your workflow:
|
Member
|
Thanks, this is useful change. To avoid splitting the discussion into two places, I am gonna comment on the issue here instead.
|
horenmar
reviewed
Aug 8, 2025
| template <typename T, typename Predicate> | ||
| GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) { | ||
| return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); | ||
| return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, typename std::remove_reference<Predicate>::type>>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); |
Member
There was a problem hiding this comment.
Suggested change
| return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, typename std::remove_reference<Predicate>::type>>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); | |
| return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, typename std::remove_reference_t<Predicate>>>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Forbid deducing reference types for m_predicate in FilterGenerator to prevent dangling references.
This is needed for out-of-line predicates to work correctly instead of undefined behavior or crashes.
GitHub Issues
Closes #3002