Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Comparison expressions don't support operators that return a non-boolean type #1147
Under Catch 2, comparison operators that return a custom type fail to compile inside CHECK and REQUIRE macros. If the intent is that CHECK and REQUIRE behave like a C++ if () statement (which seems logical) then this can be fixed pretty simply by explicitly casting to bool in compareEqual, compareNotEqual, and the relational operators in ExprLhs. If it helps, an example of the kind of operator that causes the failure is here: https://github.com/MikePopoloski/slang/blob/master/source/numeric/SVInt.h#L421
Note that this previously worked in Catch 1.x and broke when I upgraded to Catch 2.1. I have a fix locally (6 line change, file is viewable here: https://github.com/MikePopoloski/slang/blob/master/external/Catch/catch.hpp ) If it would be helpful to you I could turn that into a pull request.