From: Wolfgang Bangerth Date: Mon, 2 Oct 2017 16:33:57 +0000 (-0600) Subject: Make sure a destructor does not throw any exceptions. X-Git-Tag: v9.0.0-rc1~1008^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3e7a154447e5b6c0bd040901622d17606a2e6de;p=dealii.git Make sure a destructor does not throw any exceptions. --- diff --git a/source/base/logstream.cc b/source/base/logstream.cc index eea5f82edd..5040fde7e4 100644 --- a/source/base/logstream.cc +++ b/source/base/logstream.cc @@ -59,7 +59,17 @@ LogStream::Prefix::Prefix(const std::string &text, LogStream::Prefix::~Prefix() { - stream->pop(); + // destructors may not throw exceptions. if the pop() function + // actually does throw one, then ignore it + try + { + stream->pop(); + } + catch (...) + { + AssertNothrow (false, + ExcMessage("An exception occurred in LogStream::Prefix::~Prefix.")); + } }