From ffed880e0a3caa23bf1b23575ce9c3322de9c642 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 30 Nov 2019 00:08:59 +0100 Subject: [PATCH] Fix static assert for C++ (disable them totally as static_assert doesn't work -- It can't be used in expressions) --- m-core.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/m-core.h b/m-core.h index bccd24c3..fdb63cd0 100644 --- a/m-core.h +++ b/m-core.h @@ -2557,8 +2557,11 @@ m_core_hash (const void *str, size_t length) /* Force a compilation error if condition is false In this case, it raises "error: negative width in bit-field " */ +#if defined(__cplusplus) +#define M_STATIC_ASSERT(_e) (assert(_e)) +#else #define M_STATIC_ASSERT(_e) ((void) sizeof(struct { int a:1; int :-!(_e); })) - +#endif /************************************************************/