From dc479b3f9de06dea12105c6ea21ee263dcfd8d6a Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Tue, 28 Jun 2016 22:09:22 +0200
Subject: [PATCH] check for unsupported compilers

---
 src/json.hpp      | 14 ++++++++++++++
 src/json.hpp.re2c | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/json.hpp b/src/json.hpp
index 35bdd293..1673fb17 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -53,6 +53,20 @@ SOFTWARE.
 #include <utility>
 #include <vector>
 
+// exclude unsupported compilers
+#if defined(__clang__)
+    #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+    #if CLANG_VERSION < 34000
+        #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
+    #endif
+#endif
+#if defined(__GNUC__)
+    #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+    #if GCC_VERSION < 48000
+        #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
+    #endif
+#endif
+
 // disable float-equal warnings on GCC/clang
 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
     #pragma GCC diagnostic push
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index 016ff0c5..2672c1d0 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -53,6 +53,20 @@ SOFTWARE.
 #include <utility>
 #include <vector>
 
+// exclude unsupported compilers
+#if defined(__clang__)
+    #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+    #if CLANG_VERSION < 34000
+        #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
+    #endif
+#endif
+#if defined(__GNUC__)
+    #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+    #if GCC_VERSION < 48000
+        #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
+    #endif
+#endif
+
 // disable float-equal warnings on GCC/clang
 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
     #pragma GCC diagnostic push