]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Be more correct in our noexcept usage. 14970/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 24 Mar 2023 12:54:04 +0000 (08:54 -0400)
committerDavid Wells <drwells@email.unc.edu>
Fri, 24 Mar 2023 14:13:14 +0000 (10:13 -0400)
include/deal.II/lac/trilinos_vector.h
source/lac/trilinos_vector.cc

index 5b2d87426c3ac998c11e62e0ae0dfd4cd994e6a8..0a88440e156d3f596c2da7e97ebb6e071ce1dc6c 100644 (file)
@@ -500,8 +500,12 @@ namespace TrilinosWrappers
       /**
        * Move constructor. Creates a new vector by stealing the internal data
        * of the vector @p v.
+       *
+       * @note In order for this constructor to leave the moved-from object in a
+       * valid state it must allocate memory (in this case, an empty
+       * Epetra_FEVector) - hence it cannot be marked as noexcept.
        */
-      Vector(Vector &&v) noexcept;
+      Vector(Vector &&v); // NOLINT
 
       /**
        * Destructor.
index 1f8224118a1fa585241bde8f3eaa4ed556b9a415..6ad4335026e69cd352678c91c1bf0955d6b3f922 100644 (file)
@@ -98,10 +98,11 @@ namespace TrilinosWrappers
 
 
 
-    Vector::Vector(Vector &&v) noexcept
+    Vector::Vector(Vector &&v) // NOLINT
       : Vector()
     {
       // initialize a minimal, valid object and swap
+      static_cast<Subscriptor &>(*this) = static_cast<Subscriptor &&>(v);
       swap(v);
     }
 
@@ -499,6 +500,7 @@ namespace TrilinosWrappers
     Vector &
     Vector::operator=(Vector &&v) noexcept
     {
+      static_cast<Subscriptor &>(*this) = static_cast<Subscriptor &&>(v);
       swap(v);
       return *this;
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.