Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Catch2 should not trigger `-Werror=parentheses` by default

Open qnzhou opened this issue 3 years ago • 1 comments

Describe the bug Catch2 triggers-Werror=parentheses on linux (gcc 9.3.1). Here is the error message:

_deps/catch2-src/src/catch2/internal/catch_test_macro_impl.hpp:57:67: error: suggest parentheses around comparison in operand of ‘==’ [-Werror=parentheses]
   57 |             catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
_deps/catch2-src/src/catch2/catch_test_macros.hpp:125:26: note: in expansion of macro ‘INTERNAL_CATCH_TEST’
  125 |   #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
      |                          ^~~~~~~~~~~~~~~~~~~

Expected behavior No warning should be produced.

Reproduction steps Any REQUIRE(x == y) will do.

Platform information:

  • OS: Centos Linux 7
  • Compiler+version: GCC v9.3.1
  • Catch version: v3.3.2

Additional context This is related to https://github.com/catchorg/Catch2/issues/674, which is closed but not fixed.

qnzhou avatar Mar 10 '23 17:03 qnzhou

I'm running into the same issue using GCC 8.4.0 on Ubuntu 20.04, with Catch v3.4.0.

lethal-guitar avatar May 25 '24 19:05 lethal-guitar