From ed8429495e32537e5f426f5feb5a3b7eb0dca102 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 11 Apr 2021 11:08:13 +0200 Subject: Fix gcc warnings from having only one of assignment/copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp | 2 ++ tests/auto/corelib/tools/qcache/tst_qcache.cpp | 1 + tests/auto/corelib/tools/qhash/tst_qhash.cpp | 2 ++ 3 files changed, 5 insertions(+) (limited to 'tests/auto/corelib/tools') 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]; }; -- cgit v1.2.3