From 7c18f989d0dc430059cce70e5f0e634e18705b91 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 v2 08/23] Set up for static asserts in C++

---
 src/include/c.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/include/c.h b/src/include/c.h
index 947bd98067..7f303a4f39 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -744,14 +744,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 >= 200410
+#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.12.0

