catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.48k stars 3.02k forks source link

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

Open qnzhou opened 1 year ago

qnzhou commented 1 year ago

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:

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

lethal-guitar commented 3 months ago

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