diff --git a/test/test-assert.h b/test/test-assert.h index d91a9ccd..42844a05 100644 --- a/test/test-assert.h +++ b/test/test-assert.h @@ -22,19 +22,11 @@ class assertion_failure : public std::logic_error { void assertion_failure::avoid_weak_vtable() {} +// We use a separate function (rather than throw directly from FMT_ASSERT) to +// avoid GCC's -Wterminate warning when FMT_ASSERT is used in a destructor. inline void throw_assertion_failure (const char *message) { -# if defined(__GNUC__) && __GNUC__ >= 6 - // Avoid warnings when FMT_ASSERT is used in a destructor. -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wterminate" -# endif - throw assertion_failure(message); - -# if defined(__GNUC__) && __GNUC__ >= 6 -# pragma GCC diagnostic pop -# endif }