New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison expressions don't support operators that return a non-boolean type #1147

Closed
MikePopoloski opened this Issue Jan 12, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@MikePopoloski

MikePopoloski commented Jan 12, 2018

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.

@horenmar

This comment has been minimized.

Show comment
Hide comment
@horenmar

horenmar Jan 12, 2018

Member

Should be fixed, but another release isn't in the pipeline for a bit.

Member

horenmar commented Jan 12, 2018

Should be fixed, but another release isn't in the pipeline for a bit.

@MikePopoloski

This comment has been minimized.

Show comment
Hide comment
@MikePopoloski

MikePopoloski Jan 12, 2018

Thanks for the quick fix. My local changes are fine for now until the next release.

MikePopoloski commented Jan 12, 2018

Thanks for the quick fix. My local changes are fine for now until the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment