diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-04-11 11:08:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-11 20:30:06 +0000 |
commit | 9b808b84bf2f08f63fab248cb05d586295a90fe6 (patch) | |
tree | a12e8d395c60b483aaffc82f40b84ba1144cd1fb | |
parent | 923bb9e1581f38dec2316af5add51762c76cec7b (diff) |
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]
Change-Id: I7598e821acb7cb7bf17776d693af62778185afc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ed8429495e32537e5f426f5feb5a3b7eb0dca102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
4 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index 67e979dc14..5bcf90c0d6 100644 --- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -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() { diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index 7eb4125553..3224a8c877 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -106,6 +106,8 @@ struct Complex { --instanceCount; } + constexpr Complex &operator=(const Complex &o) noexcept + { i = o.i; return *this; } int i; static int instanceCount; diff --git a/tests/auto/corelib/tools/qcache/tst_qcache.cpp b/tests/auto/corelib/tools/qcache/tst_qcache.cpp index f8b0aba2dc..eb024e8f9e 100644 --- a/tests/auto/corelib/tools/qcache/tst_qcache.cpp +++ b/tests/auto/corelib/tools/qcache/tst_qcache.cpp @@ -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 &); diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 079b9c6ab7..d77160ba19 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -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]; }; |