postgres.git / summary / log / commit / refs
commit ebf6049ebea19e4123fefce7b542189e84084cd1
Author: Peter Eisentraut <peter_e@gmx.net>
Date: Mon Feb 19 03:20:54 2018 +0000
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.
src/include/c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/c.h b/src/include/c.h
index 6b55181e0a1..37c0c391990 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -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)
[parent: 2e1d1ebdffa2]