Commit ebf6049e authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent 2e1d1ebd
...@@ -791,7 +791,7 @@ extern void ExceptionalCondition(const char *conditionName, ...@@ -791,7 +791,7 @@ extern void ExceptionalCondition(const char *conditionName,
#define StaticAssertStmt(condition, errmessage) \ #define StaticAssertStmt(condition, errmessage) \
static_assert(condition, errmessage) static_assert(condition, errmessage)
#define StaticAssertExpr(condition, errmessage) \ #define StaticAssertExpr(condition, errmessage) \
StaticAssertStmt(condition, errmessage) ({ static_assert(condition, errmessage); })
#else #else
#define StaticAssertStmt(condition, errmessage) \ #define StaticAssertStmt(condition, errmessage) \
do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0) do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment