From dc0be2c9b096545d7f95bf44336a9e92715c629c Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 30 Aug 2016 12:00:00 -0400
Subject: [PATCH 14/27] Set up for static asserts in C++

This doesn't appear to work yet.  It might need a really new compiler.
---
 src/include/c.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/include/c.h b/src/include/c.h
index a9515d1..cbefc47 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -756,14 +756,26 @@ typedef NameData *Name;
  * about a negative width for a struct bit-field.  This will not include a
  * helpful error message, but it beats not getting an error at all.
  */
+#ifdef __cplusplus
+#if __cpp_static_assert >= 201411
+#define _Static_assert(condition, errmessage) static_assert(condition, errmessage)
+#define HAVE__STATIC_ASSERT 1
+#endif
+#endif
+
 #ifdef HAVE__STATIC_ASSERT
 #define StaticAssertStmt(condition, errmessage) \
 	do { _Static_assert(condition, errmessage); } while(0)
 #define StaticAssertExpr(condition, errmessage) \
 	({ StaticAssertStmt(condition, errmessage); true; })
 #else							/* !HAVE__STATIC_ASSERT */
+#ifdef __cplusplus
+#define  StaticAssertStmt(condition, errmessage) \
+	((void) 0)
+#else
 #define StaticAssertStmt(condition, errmessage) \
 	((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; }))
+#endif
 #define StaticAssertExpr(condition, errmessage) \
 	StaticAssertStmt(condition, errmessage)
 #endif   /* HAVE__STATIC_ASSERT */
-- 
2.9.3

