From 86579209c809dd332873c5ee60dfb71b93725c4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Krzysztof=20Wos=CC=81?= <krzysztof.wos@gmail.com>
Date: Mon, 20 Mar 2017 12:42:44 +0900
Subject: [PATCH 1/2] Make exception base class visible in basic_json

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

diff --git a/src/json.hpp b/src/json.hpp
index 9e539790..20bd25f5 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -1264,6 +1264,8 @@ class basic_json
     /// Classes to implement user-defined exceptions.
     /// @{
 
+    /// @copydoc detail::exception
+    using exception = detail::exception;
     /// @copydoc detail::parse_error
     using parse_error = detail::parse_error;
     /// @copydoc detail::invalid_iterator
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index a9a5067f..da5dd86d 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -1264,6 +1264,8 @@ class basic_json
     /// Classes to implement user-defined exceptions.
     /// @{
 
+    /// @copydoc detail::exception
+    using exception = detail::exception;
     /// @copydoc detail::parse_error
     using parse_error = detail::parse_error;
     /// @copydoc detail::invalid_iterator

From b9c3b8d688434919f9cb68f53eab8238f26e6c2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Krzysztof=20Wos=CC=81?= <krzysztof.wos@gmail.com>
Date: Mon, 20 Mar 2017 13:07:01 +0900
Subject: [PATCH 2/2] Exit with an error if re2c is not available

Instead of overwriting src/json.hpp with an empty file
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index df05e62e..20857022 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 .PHONY: pretty clean ChangeLog.md
 
 # used programs
-RE2C = re2c
+RE2C := $(shell command -v re2c 2> /dev/null)
 SED = sed
 
 # main target
@@ -185,6 +185,9 @@ clang_sanitize: clean
 
 # create scanner with re2c
 re2c: src/json.hpp.re2c
+ifndef RE2C
+	$(error "re2c is not available, please install re2c")
+endif
 	$(RE2C) -W --utf-8 --encoding-policy fail --bit-vectors --nested-ifs --no-debug-info $< | $(SED) '1d' > src/json.hpp
 
 # pretty printer