diff options
author | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2020-04-16 19:52:17 (GMT) |
---|---|---|
committer | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2020-04-24 02:22:07 (GMT) |
commit | 766ac2e1a413e87d42d67e3286c70f0af4853679 (patch) | |
tree | c9768ae1a96fee8146c0327f90db0ce0be060b8d /googlemock/test | |
parent | 4f002f1e236c1a0e7bdb096cd845f1a9c6c129c6 (diff) | |
download | googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.zip googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.tar.gz googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.tar.bz2 |
Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.
None of these are strictly needed for correctness.
A large number of them (maybe all of them?) trigger `-Wdeprecated`
warnings on Clang trunk as soon as you try to use the implicitly
defaulted (but deprecated) copy constructor of a class that has
deleted its copy assignment operator.
By declaring a deleted copy assignment operator, the old code
also caused the move constructor and move assignment operator
to be non-declared. This means that the old code never got move
semantics -- "move-construction" would simply call the defaulted
(but deprecated) copy constructor instead. With the new code,
"move-construction" calls the defaulted move constructor, which
I believe is what we want to happen. So this is a runtime
performance optimization.
Unfortunately we can't yet physically remove the definitions
of these macros from gtest-port.h, because they are being used
by other code internally at Google (according to zhangxy988).
But no new uses should be added going forward.
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 2 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 6 |
2 files changed, 0 insertions, 8 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index d1229ac..a252825 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -575,8 +575,6 @@ class FromType { private: bool* const converted_; - - GTEST_DISALLOW_ASSIGN_(FromType); }; class ToType { diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 186d8aa..5db0a7a 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -3746,17 +3746,11 @@ struct AStruct { const double y; // A const field. Uncopyable z; // An uncopyable field. const char* p; // A pointer field. - - private: - GTEST_DISALLOW_ASSIGN_(AStruct); }; // A derived struct for testing Field(). struct DerivedStruct : public AStruct { char ch; - - private: - GTEST_DISALLOW_ASSIGN_(DerivedStruct); }; // Tests that Field(&Foo::field, ...) works when field is non-const. |