mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-25 07:55:40 +02:00
Forbid deducing reference types for m_predicate in FilterGenerator (#3005)
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. --------- Co-authored-by: Tek Mate <mate.tek@evosoft.com>
This commit is contained in:
@@ -6052,6 +6052,34 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS_AS( filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Generators internals
|
||||
Filter generator
|
||||
Out-of-line predicates are copied into the generator
|
||||
-------------------------------------------------------------------------------
|
||||
GeneratorsImpl.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( gen.get() == 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( gen.next() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( gen.get() == 3 )
|
||||
with expansion:
|
||||
3 == 3
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_FALSE( gen.next() )
|
||||
with expansion:
|
||||
!false
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Generators internals
|
||||
Take generator
|
||||
@@ -19257,5 +19285,5 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2299 | 2101 passed | 157 failed | 41 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
Reference in New Issue
Block a user