HomePhabricator

Fix several -Wdeprecated-copy warnings

Description

Fix several -Wdeprecated-copy warnings

Summary:
Starting with C++11, implicit copy constructors and implicit copy assignment are deprecated. So compilers implemented warnings in the case they find a use of such an implicit definition, so the user can implicitely define them instead.

It appears that clang 13 is much more aggressive on this warning regarding the copy assignment operator than previous versions. It will warn if a default constructor is explicitely defined (but not if it's missing for some reason) for uses cases coming from the STL, like std::swap or std::vector::resize() that internally call the operator.

This diff attemps to fix the warnings by explicitely defaulting the copy assignment operator at the warning places. I already submitted several diff to fix such warnings in the past, like D5862 and D6276, hopefully this method will remain valid with the next compiler versions.

Test Plan:
With clang 10 and 13, and GCC 11

ninja all check

Check there is no warning.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D10499

Details

Provenance
FabienAuthored on Nov 23 2021, 09:12
FabienPushed on Nov 24 2021, 07:34
Reviewer
Restricted Project
Differential Revision
D10499: Fix several -Wdeprecated-copy warnings
Parents
rABC9b3b6c902490: test: Remove unused nVersion=1 in p2p tests
Branches
Unknown
Tags
Unknown