diff --git a/include/nlohmann/detail/view/macro_scope.hpp b/include/nlohmann/detail/view/macro_scope.hpp index 0aad401ac..a2d2c52c3 100644 --- a/include/nlohmann/detail/view/macro_scope.hpp +++ b/include/nlohmann/detail/view/macro_scope.hpp @@ -42,7 +42,9 @@ #define NLOHMANN_VIEW_THROW(exception) throw exception #else #include - #define NLOHMANN_VIEW_THROW(exception) std::abort() + // (the exception is built first, so that the arguments of the throwing + // helpers count as used; the program ends anyway) + #define NLOHMANN_VIEW_THROW(exception) (static_cast(exception), std::abort()) #endif #if defined(JSON_THROW_USER) #undef NLOHMANN_VIEW_THROW