-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Warnings about REQUIRE when used in templates #565
Comments
...and in case you wonder - the reason behind templated tests is basically rolling my own solution to #357. |
Since we recently improved supression of |
The current workaround for this issue is to suppress the warning for your whole test file (using the appropriate pragma for your compiler) |
Just another vote for fixing this. I have a few templated tests that worked fine in 1.7 and 1.6 but are now broken in 1.8.2 (with GCC 5.4). As a workaround I just wrapped the template definition with the CATCH_INTERNAL... macros instead of setting the pragma for the whole file. |
I am going to close this, as I moved Catch back to force disabling #define CATCH_CONFIG_MAIN
#include "catch.hpp"
template <typename T>
void foo(T) {
int a, b;
a = 1; b = 2;
REQUIRE(a == b);
}
TEST_CASE("Wparentheses") {
foo(true);
} This means that we disable the warning for GCC users even outside our assertions, but the spotty _Pragma support meant that the status quo was untenable. |
Consider this:
This produces warnings with gcc 5.3 on GNU/Linux:
When I wrap with
(
)
like gcc asks me to, it stops complaining, although on top of code becoming ugly, I lose information on the reason behind failed tests (i.e. rather than being shown useful3 == 8
, I am shownfalse
only - not useful much).The text was updated successfully, but these errors were encountered: