Make warnings in assertions fire for GCC/Clang again

The old code caused warnings to fire under MSVC, and Clang <3.8.
I could not find a GCC version where it worked, but I assume that it
did at some point.

This new code causes all of MSVC, GCC, Clang, in current versions,
to emit signed/unsigned comparison warning in test like this:

```cpp
TEST_CASE() {
    int32_t i = -1;
    uint32_t j = 1;
    REQUIRE(i != j);
}
```

Where previously only MSVC would emit the warning.

Fixes #1880
This commit is contained in:
Martin Hořeňovský
2020-03-18 20:59:25 +01:00
parent 9e09d79946
commit b7b346c3e5
3 changed files with 25 additions and 2 deletions

View File

@@ -205,10 +205,19 @@ namespace { namespace CompilationTests {
inline static void synchronizing_callback( void * ) { }
}
#if defined (_MSC_VER)
#pragma warning(push)
// The function pointer comparison below triggers warning because of
// calling conventions
#pragma warning(disable:4244)
#endif
TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) {
TestClass test;
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
}
#if defined (_MSC_VER)
#pragma warning(pop)
#endif
TEST_CASE( "#1027: Bitfields can be captured" ) {
struct Y {