You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The whole expression evaluates to an optional which should be testable, but the subexpression just | then is a sender, not something convertible to bool.
Additional context
Maybe overloading the bitwise operators is a historical choice? The workaround of course is always to put extra parens around the expression. But it's unfortunate, and is probably going to trip more people up in future (especially now that use cases are going into the standard).
The text was updated successfully, but these errors were encountered:
Describe the bug
The internal mechanism of the expression decomposer casts subexpressions to
bool
when they aren't necessarily convertible.e.g. https://github.com/catchorg/Catch2/blob/devel/src/catch2/internal/catch_decomposer.hpp#L396
This is somewhat defensible for equality/comparison operators, but less defensible for
operator|
which is increasingly used as a pipeline operator.Expected behavior
Expressions inside
CHECK
,REQUIRE
, etc, should compile when the whole expression is convertible tobool
.Reproduction steps
Consider
std::execution
(P2300) - the following would cause a compile error:The whole expression evaluates to an
optional
which should be testable, but the subexpressionjust | then
is a sender, not something convertible tobool
.Super simple example: https://compiler-explorer.com/z/v8dWxY474
Platform information:
Not platform-specific.
Additional context
Maybe overloading the bitwise operators is a historical choice? The workaround of course is always to put extra parens around the expression. But it's unfortunate, and is probably going to trip more people up in future (especially now that use cases are going into the standard).
The text was updated successfully, but these errors were encountered: