Commit `b710039` breaks tests with overloaded `operator==`
Maintainer thường phản hồi trong vòng 2 ngày
@michaelbawuah đang làm issue này rồi.
Từ ngày 13/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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>
- Ngôn ngữ chính
- C++
- Star
- 21.6k
- Fork
- 3.4k
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của catchorg/Catch2
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
catch_discover_tests passes all EXTRA_ARGS as one argumentCó thể đã có người làm @CyberKun đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
catchorg/Catch2#3239 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Not seeing some error messages from fakeit in jetbrains riderCó thể đã có người làm @Amanpal9 đã nhận 21 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
catchorg/Catch2#3228 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Có thể đã có người làm @nafiurahman00 đã nhận 8 ngày trước. Đang mởExtras
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
catchorg/Catch2#3241 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của catchorg/Catch2
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cp-algorithms/cp-algorithms#1774 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
telefonicaid/fiware-orion#4836 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nixd exits at startup when its parent process belongs to another userCó thể đã có người làm @conao3 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nix-community/nixd#930 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
refactor topic-ui topic-weather
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Command-Install Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
microsoft/winget-cli#6718 ·
Maintainer thường phản hồi trong vòng 2 ngày