Add enum types to what is captured by value by default

As it turns out, enums can be used to declare bitfields, and we
cannot form a reference to a bitfield in the cpature. Thus, we add
`std::is_enum` as a criteria to the default for `capture_by_value`,
so that enum-based bitfields are also captured by value and thus
decomposable.

Closes #3001
This commit is contained in:
Martin Hořeňovský
2025-07-29 23:51:13 +02:00
parent a1c7ee115f
commit ccabd4de89
20 changed files with 164 additions and 29 deletions

View File

@@ -772,6 +772,22 @@ Generators.tests.cpp:<line number>: FAILED:
due to unexpected exception with message:
failure to init
-------------------------------------------------------------------------------
#3001: Enum-based bitfields can be captured
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
...............................................................................
Compilation.tests.cpp:<line number>: PASSED:
REQUIRE( bf.e == 1 )
with expansion:
1 == 1
Compilation.tests.cpp:<line number>: PASSED:
REQUIRE( 1 == bf.e )
with expansion:
1 == 1
-------------------------------------------------------------------------------
#748 - captures with unexpected exceptions
outside assertions
@@ -952,6 +968,6 @@ Condition.tests.cpp:<line number>: FAILED:
CHECK( true != true )
===============================================================================
test cases: 33 | 27 passed | 3 failed | 3 failed as expected
assertions: 102 | 94 passed | 4 failed | 4 failed as expected
test cases: 34 | 28 passed | 3 failed | 3 failed as expected
assertions: 104 | 96 passed | 4 failed | 4 failed as expected