Fix gcc warnings from having only one of assignment/copy

For example:
warning: implicitly-declared
‘constexpr Complex& Complex::operator=(const Complex&)’
is deprecated [-Wdeprecated-copy]

Pick-to: 6.1
Change-Id: I7598e821acb7cb7bf17776d693af62778185afc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Volker Hilsheimer 2021-04-11 11:08:13 +02:00
parent fa3b672f99
commit ed8429495e
4 changed files with 7 additions and 0 deletions

View File

@ -1618,6 +1618,8 @@ public:
{ currentInstanceCount.fetchAndAddRelaxed(-1);}
inline InstanceCounter(const InstanceCounter &)
{ currentInstanceCount.fetchAndAddRelaxed(1); updatePeak(); }
constexpr InstanceCounter &operator=(const InstanceCounter &) noexcept
{ return *this; }
void updatePeak()
{

View File

@ -106,6 +106,8 @@ struct Complex
{
--instanceCount;
}
constexpr Complex &operator=(const Complex &o) noexcept
{ i = o.i; return *this; }
int i;
static int instanceCount;

View File

@ -359,6 +359,7 @@ struct KeyType
int foo;
KeyType(int x) : foo(x) {}
constexpr KeyType(const KeyType &o) noexcept : foo(o.foo) {}
private:
KeyType &operator=(const KeyType &);

View File

@ -97,6 +97,8 @@ struct Foo {
Foo():c(count) { ++count; }
Foo(const Foo& o):c(o.c) { ++count; }
~Foo() { --count; }
constexpr Foo &operator=(const Foo &o) noexcept { c = o.c; return *this; }
int c;
int data[8];
};