From ebf6049ebea19e4123fefce7b542189e84084cd1 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 18 Feb 2018 22:20:54 -0500 Subject: [PATCH] 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 6b55181e0a..37c0c39199 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) -- 2.40.0