From 611c5f044c20847faa090d0b56f2189dd9d32bfd Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 15 Oct 2013 10:10:55 +0000 Subject: [PATCH] Add noexcept(false) also to ~GrowingVectorMemory (and its base class) git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31236 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/subscriptor.h | 6 ++++++ deal.II/include/deal.II/lac/vector_memory.h | 12 ++++++++++-- deal.II/source/lac/vector_memory.cc | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/deal.II/include/deal.II/base/subscriptor.h b/deal.II/include/deal.II/base/subscriptor.h index f46b7792fa..d546c876e8 100644 --- a/deal.II/include/deal.II/base/subscriptor.h +++ b/deal.II/include/deal.II/base/subscriptor.h @@ -76,6 +76,12 @@ public: * is zero. */ #ifdef DEAL_II_USE_CXX11 + // According to the C++11 standard [class.dtor] 3 in combination with + // [except.spec] 14 and [except.spec] 9---as explained in detail in + // [1]---we're guilty of just terminating in case of throwing an + // exception in ~Subscriptor if we do not annotate it with + // "noexcept(false)" + // [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3204.htm virtual ~Subscriptor() noexcept(false); #else virtual ~Subscriptor(); diff --git a/deal.II/include/deal.II/lac/vector_memory.h b/deal.II/include/deal.II/lac/vector_memory.h index 069ce99e85..b85c7a3ec2 100644 --- a/deal.II/include/deal.II/lac/vector_memory.h +++ b/deal.II/include/deal.II/lac/vector_memory.h @@ -80,7 +80,11 @@ public: * as there are virtual functions * in this class. */ - virtual ~VectorMemory() {} +#ifdef DEAL_II_USE_CXX11 + virtual ~VectorMemory () noexcept(false) {} +#else + virtual ~VectorMemory () {} +#endif /** * Return a pointer to a new @@ -283,7 +287,11 @@ public: * a warning message, if there * are allocated vectors left. */ - ~GrowingVectorMemory(); +#ifdef DEAL_II_USE_CXX11 + virtual ~GrowingVectorMemory() noexcept(false); +#else + virtual ~GrowingVectorMemory(); +#endif /** * Return a pointer to a new diff --git a/deal.II/source/lac/vector_memory.cc b/deal.II/source/lac/vector_memory.cc index ecc97a6b0d..2ed69eea80 100644 --- a/deal.II/source/lac/vector_memory.cc +++ b/deal.II/source/lac/vector_memory.cc @@ -102,7 +102,7 @@ GrowingVectorMemory::GrowingVectorMemory (const size_type initial_size, template inline -GrowingVectorMemory::~GrowingVectorMemory() +GrowingVectorMemory::~GrowingVectorMemory() noexcept(false) { AssertThrow(current_alloc == 0, StandardExceptions::ExcMemoryLeak(current_alloc)); -- 2.39.5