From af78690b0f6dc7c77f2254293088aefcc866cd85 Mon Sep 17 00:00:00 2001
From: David Wells <drwells@email.unc.edu>
Date: Fri, 24 Mar 2023 08:54:04 -0400
Subject: [PATCH] Be more correct in our noexcept usage.

---
 include/deal.II/lac/trilinos_vector.h | 6 +++++-
 source/lac/trilinos_vector.cc         | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h
index 5b2d87426c..0a88440e15 100644
--- a/include/deal.II/lac/trilinos_vector.h
+++ b/include/deal.II/lac/trilinos_vector.h
@@ -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.
diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc
index 1f8224118a..6ad4335026 100644
--- a/source/lac/trilinos_vector.cc
+++ b/source/lac/trilinos_vector.cc
@@ -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;
     }
-- 
2.39.5