Use uncaught_exceptions in C++17

This commit is contained in:
Howard Hinnant 2018-06-06 13:52:23 -04:00
parent af415701ba
commit 48baa942fc
2 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@
--- ---
**[Try it out on wandbox!](https://wandbox.org/permlink/akDd3tAEwxZtdB2B)** **[Try it out on wandbox!](https://wandbox.org/permlink/L8MwjzSSC3fXXrMd)**
## Summary ## Summary

View File

@ -1080,7 +1080,12 @@ class save_ostream
public: public:
~save_ostream() ~save_ostream()
{ {
if ((this->flags_ & std::ios::unitbuf) && !std::uncaught_exception() && if ((this->flags_ & std::ios::unitbuf) &&
#if __cplusplus >= 201703
std::uncaught_exceptions() == 0 &&
#else
!std::uncaught_exception() &&
#endif
this->is_.good()) this->is_.good())
this->is_.rdbuf()->pubsync(); this->is_.rdbuf()->pubsync();
} }