Skip to content

Commit

Permalink
Fix a -Wdeprecated warning.
Browse files Browse the repository at this point in the history
    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&);
             ^
  • Loading branch information
Quuxplusone committed Apr 16, 2020
1 parent b543eb7 commit 0d2269c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions googletest/test/googletest-param-test-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,15 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
class NonDefaultConstructAssignString {
public:
NonDefaultConstructAssignString(const std::string& s) : str_(s) {}
NonDefaultConstructAssignString() = delete;
NonDefaultConstructAssignString(const NonDefaultConstructAssignString&) = default;
NonDefaultConstructAssignString& operator=(const NonDefaultConstructAssignString&) = delete;
~NonDefaultConstructAssignString() = default;

const std::string& str() const { return str_; }

private:
std::string str_;

// Not default constructible
NonDefaultConstructAssignString();
// Not assignable
void operator=(const NonDefaultConstructAssignString&);
};

TEST(CombineTest, NonDefaultConstructAssign) {
Expand Down

0 comments on commit 0d2269c

Please sign in to comment.