Commit `b710039` breaks tests with overloaded `operator==`
メンテナーはふだん 2 日以内に返信
@michaelbawuah がすでに取り組んでいます。
2026年10月13日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
- 領域
- testing-qa
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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>
- 主要言語
- C++
- スター
- 21.6k
- フォーク
- 3.4k
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
catchorg/Catch2 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 2 日以内に返信
-
catch_discover_tests passes all EXTRA_ARGS as one argument対応中かも @CyberKun が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
catchorg/Catch2#3239 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Not seeing some error messages from fakeit in jetbrains rider対応中かも @Amanpal9 が 21 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
catchorg/Catch2#3228 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0対応中かも @nafiurahman00 が 8 日前に担当しました。 オープンExtras
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
catchorg/Catch2#3241 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
catchorg/Catch2 の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cp-algorithms/cp-algorithms#1774 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
telefonicaid/fiware-orion#4836 ·
メンテナーはふだん 1 日以内に返信
-
nixd exits at startup when its parent process belongs to another user対応中かも @conao3 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nix-community/nixd#930 ·
メンテナーはふだん 2 日以内に返信
-
refactor topic-ui topic-weather
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Command-Install Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
microsoft/winget-cli#6718 ·
メンテナーはふだん 2 日以内に返信