From: Daniel Arndt Date: Mon, 3 Mar 2025 16:11:08 +0000 (-0600) Subject: Assert: Avoid warnings about unused variables before C++20 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b04ac42897f03e31d7ce4aa0bcaf077df4a71ab;p=dealii.git Assert: Avoid warnings about unused variables before C++20 --- diff --git a/include/deal.II/base/exception_macros.h b/include/deal.II/base/exception_macros.h index f663107f45..53c72169f3 100644 --- a/include/deal.II/base/exception_macros.h +++ b/include/deal.II/base/exception_macros.h @@ -636,10 +636,13 @@ DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } \ while (false) # else -# define Assert(cond, exc) \ - do \ - { \ - } \ +# define Assert(cond, exc) \ + do \ + { \ + if constexpr (false) \ + if (!(cond)) \ + ; \ + } \ while (false) # endif #endif /*ifdef DEBUG*/