diff options
-rw-r--r-- | libbutl/fdstream.cxx | 10 | ||||
-rw-r--r-- | libbutl/utility.mxx | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx index 9eb810a..18fcf11 100644 --- a/libbutl/fdstream.cxx +++ b/libbutl/fdstream.cxx @@ -42,12 +42,13 @@ #include <new> // bad_alloc #include <limits> // numeric_limits #include <cstring> // memcpy(), memmove() -#include <exception> // uncaught_exception() +#include <exception> // uncaught_exception[s]() #include <stdexcept> // invalid_argument #include <type_traits> #include <system_error> #endif +#include <libbutl/ft/exception.hxx> // uncaught_exceptions #include <libbutl/process-details.hxx> #ifdef __cpp_modules @@ -651,7 +652,14 @@ namespace butl // using ofdstream in a dtor being called while unwinding the stack due to // an exception. // + // C++17 deprecated uncaught_exception() so use uncaught_exceptions() if + // available. + // +#ifdef __cpp_lib_uncaught_exceptions + assert (!is_open () || !good () || uncaught_exceptions () != 0); +#else assert (!is_open () || !good () || uncaught_exception ()); +#endif } void ofdstream:: diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx index 410dae8..3f23581 100644 --- a/libbutl/utility.mxx +++ b/libbutl/utility.mxx @@ -19,7 +19,7 @@ #include <cstddef> // size_t #include <utility> // move(), forward() #include <cstring> // strcmp(), strlen() -#include <exception> // exception, uncaught_exception(s)() +#include <exception> // exception, uncaught_exception[s]() //#include <functional> // hash #include <cctype> // toupper(), tolower(), isalpha(), isdigit(), isalnum() |