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
Describe the bug
The test doesn't compile when the user provides a more general operator == overload than ExprLhs. operator == in the code sample below is a better match when r-value reference is passed because it accepts forwarding reference (U&&) and ExprLhs accepts only const reference (RhsT const& rhs) https://github.com/catchorg/Catch2/blob/devel/src/catch2/internal/catch_decomposer.hpp#L187
Unrelated note
I don't think const reference here prolongs the lifetime of rhs, because it's not local but stored in a class: BinaryExpr<LhsT, RhsT const&>. Not sure if it's a problem.
The text was updated successfully, but these errors were encountered:
Describe the bug
The test doesn't compile when the user provides a more general
operator ==
overload thanExprLhs
.operator ==
in the code sample below is a better match when r-value reference is passed because it accepts forwarding reference (U&&
) andExprLhs
accepts only const reference (RhsT const& rhs
) https://github.com/catchorg/Catch2/blob/devel/src/catch2/internal/catch_decomposer.hpp#L187Expected behavior
The test should compile.
Reproduction steps
error: no matching member function for call to 'handleExpr' REQUIRE(0 == adl::activate_adl{});
Fix
My first attempt was to change the
operator ==
definition (and similarly all other operators) toHowever, this broke a test for bitfields
error: non-const reference cannot bind to bit-field 'v' REQUIRE(0 == y.v);
This can be resolved by two not so clean overloads, maybe you know a better way:
Unrelated note
I don't think const reference here prolongs the lifetime of rhs, because it's not local but stored in a class:
BinaryExpr<LhsT, RhsT const&>
. Not sure if it's a problem.The text was updated successfully, but these errors were encountered: