On Fri, Mar 13, 2020 at 03:12:34PM +0900, Michael Paquier wrote:
> On Thu, Mar 12, 2020 at 09:43:54AM -0400, Tom Lane wrote:
>> I don't feel a need to expend a whole lot of sweat there.  The existing
>> text is fine, it just bugged me that the code deals with three cases
>> while the comment block only acknowledged two.  So I'd just go with
>> what you have in v3.
> 
> Thanks, Tom.  I have committed v3 then.

Hmm.  v3 actually broke the C++ fallback of StaticAssertExpr() and
StaticAssertStmt() (v1 did not), a simple fix being something like
the attached.

The buildfarm does not really care about that, but it could for
example by using the only c++ code compiled in the tree in
src/backend/jit/?  That also means that only builds using --with-llvm
with a compiler old enough would trigger that stuff.
--
Michael
diff --git a/src/include/c.h b/src/include/c.h
index 6558801e5f..51db902fc3 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -860,8 +860,13 @@ extern void ExceptionalCondition(const char *conditionName,
 	static_assert(condition, errmessage)
 #else
 /* Fallback implementation for C and C++ */
+#ifndef __cplusplus
 #define StaticAssertStmt(condition, errmessage) \
 	((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))
+#else
+#define StaticAssertStmt(condition, errmessage) \
+	do { struct static_assert_struct { int static_assert_failure : (condition) ? 1 : -1; }; } while(0)
+#endif		/* __cplusplus */
 #define StaticAssertExpr(condition, errmessage) \
 	StaticAssertStmt(condition, errmessage)
 #define StaticAssertDecl(condition, errmessage) \

Attachment: signature.asc
Description: PGP signature

Reply via email to