From 57287f26756a2a018e9a0b2412000da5a1bbebcd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 23 Nov 2017 15:31:15 +0200 Subject: Use uncaught_exceptions() if available C++17 deprecated uncaught_exception() and GCC 8 now issues a warning. --- libbutl/fdstream.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libbutl/fdstream.cxx') 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 // bad_alloc #include // numeric_limits #include // memcpy(), memmove() -#include // uncaught_exception() +#include // uncaught_exception[s]() #include // invalid_argument #include #include #endif +#include // uncaught_exceptions #include #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:: -- cgit v1.1