Deleted potentially implicitly generated functions.

Here we explicitly disable rvalue constructors and assignment
operators for `flags::FlagsBase` since we plan for this class to be
used in virtual inheritance scenarios.  Here e.g., constructing from
an rvalue will be problematic since we can potentially have multiple
lineages leading to the same base class, and could then potentially
use a moved from base object.

These functions would be implicitly generated only for C++14, but in
C++11 only the versions taking lvalue references should be. GCC seems
to create all of these even in C++11 mode so we need to explicitly
disable them.

Review: https://reviews.apache.org/r/52386/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5d491eb7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5d491eb7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5d491eb7

Branch: refs/heads/master
Commit: 5d491eb77a9268feaec0587e79808e7805907317
Parents: da2aa2c
Author: Benjamin Bannier <benjamin.bann...@mesosphere.io>
Authored: Mon Oct 17 05:33:17 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Mon Oct 17 05:34:41 2016 -0400

----------------------------------------------------------------------
 3rdparty/stout/include/stout/flags/flags.hpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5d491eb7/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp 
b/3rdparty/stout/include/stout/flags/flags.hpp
index 3c2ad4a..e00aedf 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -45,7 +45,23 @@ class FlagsBase
 {
 public:
   FlagsBase() { add(&help, "help", "Prints this help message", false); }
-  virtual ~FlagsBase() {}
+  virtual ~FlagsBase() = default;
+
+  // Explicitly disable rvalue constructors and assignment operators
+  // since we plan for this class to be used in virtual inheritance
+  // scenarios. Here e.g., constructing from an rvalue will be
+  // problematic since we can potentially have multiple lineages
+  // leading to the same base class, and could then potentially use a
+  // moved from base object.
+  // All of the following functions would be implicitly generated for
+  // C++14, but in C++11 only the versions taking lvalue references
+  // should be. GCC seems to create all of these even in C++11 mode so
+  // we need to explicitly disable them.
+  FlagsBase(const FlagsBase&) = default;
+  FlagsBase(FlagsBase&&) = delete;
+  FlagsBase& operator=(const FlagsBase&) = default;
+  FlagsBase& operator=(FlagsBase&&) = delete;
+
 
   // Load any flags from the environment given the variable prefix,
   // i.e., given prefix 'STOUT_' will load a flag named 'foo' via

Reply via email to