Fix build on CentOS 7
authorPaul Bauer <paul.bauer.q@gmail.com>
Fri, 27 Nov 2020 14:37:28 +0000 (15:37 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Sun, 29 Nov 2020 18:36:33 +0000 (18:36 +0000)
The compiler toolset coming with devtoolset-7 on CentOS still suffers
from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265. The workaround
for this has been removed before because other gcc-7 compilers are not
affected by this, but it is obviously still needed for CentOS.

Fixes #3826

src/gromacs/mdrun/runner.cpp
src/gromacs/mdrun/runner.h

index e78faae8d511116296804c5e9a3276e829970363..513d7733eeb026d62b1fb2ce94416af52c9685ae 100644 (file)
@@ -1882,7 +1882,8 @@ Mdrunner::Mdrunner(std::unique_ptr<MDModules> mdModules) : mdModules_(std::move(
 
 Mdrunner::Mdrunner(Mdrunner&&) noexcept = default;
 
-Mdrunner& Mdrunner::operator=(Mdrunner&& /*handle*/) noexcept = default;
+//NOLINTNEXTLINE(performance-noexcept-move-constructor) working around GCC bug 58265 in CentOS 7
+Mdrunner& Mdrunner::operator=(Mdrunner&& /*handle*/) noexcept(BUGFREE_NOEXCEPT_STRING) = default;
 
 class Mdrunner::BuilderImplementation
 {
index 703e632b34cf4bf18e1f35d9f6d8f85e0709945d..a0c9cdc95df85401ec2b10a98db393cc0f13cc84 100644 (file)
@@ -78,6 +78,9 @@ class RestraintManager;
 class SimulationContext;
 class StopHandlerBuilder;
 
+//! Work-around for GCC bug 58265 still present in CentOS 7 devtoolset-7
+constexpr bool BUGFREE_NOEXCEPT_STRING = std::is_nothrow_move_assignable<std::string>::value;
+
 /*! \libinternal \brief Runner object for supporting setup and execution of mdrun.
  *
  * This class has responsibility for the lifetime of data structures
@@ -143,7 +146,8 @@ public:
      * \{
      */
     Mdrunner(Mdrunner&& handle) noexcept;
-    Mdrunner& operator=(Mdrunner&& handle) noexcept;
+    //NOLINTNEXTLINE(performance-noexcept-move-constructor) working around GCC bug 58265 in CentOS 7
+    Mdrunner& operator=(Mdrunner&& handle) noexcept(BUGFREE_NOEXCEPT_STRING);
     /* \} */
 
     /*! \brief Driver routine, that calls the different simulation methods. */