Commit `b710039` breaks tests with overloaded `operator==`
Maintainers usually reply within 2 days
@michaelbawuah is already working on this.
Since Oct 13, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- testing-qa
Research direction
Start by tracing the equality expression decomposition in src/catch2/internal/catch_decomposer.hpp, especially the operators around the reported line 345, and compare the behavior before and after commit b710039. Use the reduced reproduction from the issue as the first compile check. Done means the global operator== overload works inside a top-level REQUIRE and the relevant Catch2 tests pass.
Written by the indexing model from the issue text.
Description
Describe the bug
I have code with a operator== overload in the global scope (it is meant to be used with classes from std::).
REQUIRE assertions which use this operator at the top-level fail to compile since 3.16.1 / b710039a0848aa58bbe4e1bc270e7b0c809b676d.
Expected behavior
The following code compiles and runs fine.
Reproduction steps
This is a reduced example.
namespace test {
struct S {
int x;
};
}
constexpr bool operator==(const test::S& lhs, const test::S& rhs)
{
return lhs.x == rhs.x;
}
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Test")
{
REQUIRE(test::S{1} == test::S{1});
}
Platform information:
- OS: Up-to-date Arch Linux (12/Oct/2026)
- Compiler+version: GCC 16.2.1 20260810
- Catch version: v3.16.1
Additional context
Error message:
/usr/include/catch2/internal/catch_decomposer.hpp:345:5: error: no match for ‘operator==’ (operand types are ‘const test::S’ and ‘test::S’)
345 | CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
| ^
• there are 2 candidates
• candidate 1: ‘template<class LhsT, class RhsT, class T> const Catch::BinaryExpr<LhsT, const RhsT&> Catch::operator==(const BinaryExpr<LhsT, RhsT>&, T)’
/usr/include/catch2/internal/catch_decomposer.hpp:239:5:
239 | CATCH_INTERNAL_DEFINE_BINARY_EXPR_OPERATOR( == )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
• template argument deduction/substitution failed:
• ‘const test::S’ is not derived from ‘const Catch::BinaryExpr<LhsT, RhsT>’
/usr/include/catch2/internal/catch_decomposer.hpp:345:5:
345 | CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
| ^
• candidate 2: ‘template<class LhsT, class RhsT> constexpr std::enable_if_t<((bool)std::conjunction<Catch::Detail::is_eq_comparable_impl<typename std::remove_reference<_Tp>::type&, typename std::remove_reference<_Arg>::type&, void>, std::negation<Catch::capture_by_value<typename std::remove_cv<typename std::remove_reference<_Arg>::type>::type> > >::value), Catch::BinaryExpr<LhsT, const RhsT&> > Catch::operator==(ExprLhs<LhsT>&&, RhsT&&)’
/usr/include/catch2/internal/catch_decomposer.hpp:345:5:
345 | CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
• template argument deduction/substitution failed:
• types ‘Catch::ExprLhs<LhsT>’ and ‘const test::S’ have incompatible cv-qualifiers
/usr/include/catch2/internal/catch_decomposer.hpp:345:5:
345 | CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
| ^
/usr/include/catch2/internal/catch_decomposer.hpp:345:5: error: could not convert ‘{<expression error>, (& lhs)->Catch::ExprLhs<const test::S&>::getLhs(), Catch::operator""_sr(((const char*)"=="), 2), rhs}’ from ‘<brace-enclosed initializer list>’ to ‘std::enable_if_t<true, Catch::BinaryExpr<const test::S&, const test::S&> >’ {aka ‘Catch::BinaryExpr<const test::S&, const test::S&>’}
345 | CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| <brace-enclosed initializer list>
- Dominant language
- C++
- Stars
- 21.6k
- Forks
- 3.4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from catchorg/Catch2
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 2 days
-
catch_discover_tests passes all EXTRA_ARGS as one argumentPossibly taken @CyberKun claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
catchorg/Catch2#3239 · 1 comment ·
Maintainers usually reply within 2 days
-
Not seeing some error messages from fakeit in jetbrains riderPossibly taken @Amanpal9 claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
catchorg/Catch2#3228 · 1 comment ·
Maintainers usually reply within 2 days
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Possibly taken @nafiurahman00 claimed this 8 days ago. OpenExtras
Difficulty 3/5 1-2 days Newbie friendliness 72/100
catchorg/Catch2#3241 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cp-algorithms/cp-algorithms#1774 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
telefonicaid/fiware-orion#4836 ·
Maintainers usually reply within 1 day
-
nixd exits at startup when its parent process belongs to another userPossibly taken @conao3 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nix-community/nixd#930 ·
Maintainers usually reply within 2 days
-
refactor topic-ui topic-weather
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Command-Install Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
microsoft/winget-cli#6718 ·
Maintainers usually reply within 2 days