From 03074ed54020be342675a5e5cd345df8bf54a8d0 Mon Sep 17 00:00:00 2001 From: Daniele Date: Fri, 22 Dec 2023 12:42:19 +0100 Subject: [PATCH] Removed a should from Exception.h --- src/tools/Exception.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/Exception.h b/src/tools/Exception.h index 0792da371a..4b008fda12 100644 --- a/src/tools/Exception.h +++ b/src/tools/Exception.h @@ -381,10 +381,11 @@ class ExceptionTypeError : #ifdef NDEBUG // These are the versions used when compiling with NDEBUG flag. -// The condition is always true, so that the rest of the statement -// should be optimized away. -#define plumed_dbg_assert(test) plumed_assert(true) -#define plumed_dbg_massert(test,msg) plumed_massert(true,msg) +// The if constexpr(false) gurarantees that the compiler will optimize away the assertion +// We are not using an empty macro becasue the user may want to use the << operator + +#define plumed_dbg_assert(test) if constexpr(false) plumed_assert(true) +#define plumed_dbg_massert(test,msg) if constexpr(false) plumed_massert(true,msg) #else