Skip to content

Simple#2774

Closed
Quuxplusone wants to merge 5 commits intogoogle:masterfrom
Quuxplusone:simple
Closed

Simple#2774
Quuxplusone wants to merge 5 commits intogoogle:masterfrom
Quuxplusone:simple

Conversation

@Quuxplusone
Copy link
Copy Markdown
Contributor

No description provided.

…or. 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;
                       ^
/home/travis/build/Quuxplusone/googletest/googletest/test/googletest-port-test.cc:97:11: error:
      definition of implicit copy constructor for 'Base' is deprecated because
      it has a user-declared destructor [-Werror,-Wdeprecated]
  virtual ~Base() {}
          ^
/home/travis/build/Quuxplusone/googletest/googletest/test/googletest-port-test.cc:116:56: note:
      implicit copy constructor for 'Base' first required here
  Base base = ::testing::internal::ImplicitCast_<Base>(derived);
                                                       ^
/home/travis/build/Quuxplusone/googletest/googletest/test/googletest-param-test-test.cc:502:8: error:
      definition of implicit copy constructor for
      'NonDefaultConstructAssignString' is deprecated because it has a
      user-declared copy assignment operator [-Werror,-Wdeprecated]
  void operator=(const NonDefaultConstructAssignString&);
       ^
/home/travis/build/Quuxplusone/googletest/googletest/test/googletest-param-test-test.cc:507:36: note:
      implicit copy constructor for 'NonDefaultConstructAssignString' first
      required here
      Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"),
                                   ^
…assignable.

Any class with a data member that's `const` or of reference type
has no `operator=` by definition; we don't have to redundantly
specify it. Therefore this commit has no functional change.
(But the next one will have.)
For the user-facing classes `Test`, `TestSuite`, etc., where there were
explicit C++ comments saying that we delete the special members, I added
the deleted special member declarations by hand.

For `VariadicMatcher`, we actually NEED to cut short the compiler's
deliberations about whether the type is copyable, because if we don't,
it recurses down into the `std::tuple` and triggers Clang's error
"recursive template instantiation exceeded maximum depth of 256".
However, `VariadicMatcher` does need to be copy-constructible, so
we default its copy constructor (to avoid `-Wdeprecated-copy`, see below).

For every other case, where these are internal implementation details
that nobody in their right mind would ever try to do value semantics with,
I just removed the deleted members, following the Rule of Zero.

This commit fixes all Clang trunk's warnings about `-Wdeprecated-copy`,
for example:

    /home/travis/build/Quuxplusone/googletest/googlemock/include/gmock/gmock-actions.h:579:3: error:
          definition of implicit copy constructor for
          'PolymorphicAction<testing::internal::ReturnNullAction>' is deprecated
          because it has a user-declared copy assignment operator
          [-Werror,-Wdeprecated]
      GTEST_DISALLOW_ASSIGN_(PolymorphicAction);
      ^
    /home/travis/build/Quuxplusone/googletest/googletest/include/gtest/internal/gtest-port.h:679:9: note:
          expanded from macro 'GTEST_DISALLOW_ASSIGN_'
      type& operator=(type const &) = delete
            ^
    /home/travis/build/Quuxplusone/googletest/googlemock/include/gmock/gmock-actions.h:1166:10: note:
          implicit copy constructor for
          'PolymorphicAction<testing::internal::ReturnNullAction>' first required
          here
      return MakePolymorphicAction(internal::ReturnNullAction());
             ^

and:

    /home/travis/build/Quuxplusone/googletest/googlemock/test/gmock-spec-builders_test.cc:1883:1: error:
          definition of implicit copy constructor for 'DeleteActionP<(anonymous
          namespace)::MockA *>' is deprecated because it has a user-declared copy
          assignment operator [-Werror,-Wdeprecated]
    ACTION_P(Delete, ptr) { delete ptr; }
    ^
@Quuxplusone
Copy link
Copy Markdown
Contributor Author

Oops. I guess I hit "Enter" in the wrong tab. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants