Skip to content
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

Catch2 does not provide a helpful message when logical operators are used in an assertion #1273

Closed
horenmar opened this issue May 4, 2018 · 0 comments

Comments

@horenmar
Copy link
Member

horenmar commented May 4, 2018

Description

Catch Classic used to provide a fairly helpful error message when && or || was used in an assertion, as the compilation failed inside a type whose name explained the error. For Catch2, the error message looks like this

test1.cpp(6): error C2676: binary '&&': 'Catch::ExprLhs<int *const &>' does not define this operator or a conversion to a type acceptable to the predefined operator

which is not exactly helpful.

Extra information

This was changed during the rewrite of capture layer, likely as an oversight.

  • Catch version: v2.x.x
horenmar pushed a commit that referenced this issue Jan 1, 2019
As explained in issue #1273, `operator&&` and `operator||` should give
a proper compile time error on use instead of the compiler complaining
about them not being defined. This commit adds an `always_false` type in
`catch_meta.hpp` used for implementing a nice `static_assert` for both
of the abovementioned operators.

Closes #1273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant