Fix -Wdeprecated warnings due to Expectation's user-provided destructor. NFC.

/home/travis/build/Quuxplusone/googletest/googlemock/include/gmock/gmock-spec-builders.h:503:3: error:
      definition of implicit copy constructor for 'Expectation' is deprecated
      because it has a user-declared destructor [-Werror,-Wdeprecated]
  ~Expectation();
  ^
/home/travis/build/Quuxplusone/googletest/googlemock/src/gmock-spec-builders.cc:496:14: note:
      implicit copy constructor for 'Expectation' first required here
      return Expectation(*it);
             ^
/home/travis/build/Quuxplusone/googletest/googlemock/src/gmock-spec-builders.cc:854:14: error:
      definition of implicit copy assignment operator for 'Expectation' is
      deprecated because it has a user-declared destructor
      [-Werror,-Wdeprecated]
Expectation::~Expectation() {}
             ^
/home/travis/build/Quuxplusone/googletest/googlemock/src/gmock-spec-builders.cc:863:24: note:
      implicit copy assignment operator for 'Expectation' first required here
    *last_expectation_ = expectation;
                       ^
This commit is contained in:
Arthur O'Dwyer 2020-03-28 14:20:48 -04:00
parent 67cc66080d
commit eb69ae8202

View File

@ -499,7 +499,8 @@ class GTEST_API_ Expectation {
public:
// Constructs a null object that doesn't reference any expectation.
Expectation();
Expectation(const Expectation&) = default;
Expectation& operator=(const Expectation&) = default;
~Expectation();
// This single-argument ctor must not be explicit, in order to support the
@ -513,9 +514,6 @@ class GTEST_API_ Expectation {
// ExpectationBase object.
Expectation(internal::ExpectationBase& exp); // NOLINT
// The compiler-generated copy ctor and operator= work exactly as
// intended, so we don't need to define our own.
// Returns true if and only if rhs references the same expectation as this
// object does.
bool operator==(const Expectation& rhs) const {