From a18eef8d31bfc53e2b5f374f6d290e4481205140 Mon Sep 17 00:00:00 2001 From: Jamie Seward Date: Tue, 24 Oct 2017 01:34:27 -0700 Subject: [PATCH] Add RTTI disabled logic --- src/json.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index c13cdfa1c..0771a610b 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -506,11 +506,18 @@ class other_error : public exception template void try_throw_exception(exception* ex) { +#ifdef JSON_EXCEPTIONS_ENABLED + // Only use RTTI if necessary (exceptions are enabled). This way + // can be compiled with no RTTI. Exception* down = dynamic_cast(ex); if(down != nullptr) { JSON_THROW(*down); } +#else + ex = ex; // suppress unreferenced formal parameter warnings + std::abort(); +#endif } /*!