Fix StaticAssertExpr() under C++

The previous code didn't compile, because static_assert() must end with
a semicolon.  To fix, wrap it in a block, similar to the C code.
This commit is contained in:
Peter Eisentraut 2018-02-18 22:20:54 -05:00
parent 2e1d1ebdff
commit ebf6049ebe

View File

@ -791,7 +791,7 @@ extern void ExceptionalCondition(const char *conditionName,
#define StaticAssertStmt(condition, errmessage) \
static_assert(condition, errmessage)
#define StaticAssertExpr(condition, errmessage) \
StaticAssertStmt(condition, errmessage)
({ static_assert(condition, errmessage); })
#else
#define StaticAssertStmt(condition, errmessage) \
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)