From cc21148ce02b9dd111e9821411846541187297bb Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Fri, 30 Aug 2019 21:54:47 +0200 Subject: [PATCH] common: Remove the copy assignment operator from DccConfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since C++11 the standard no longer mandates the existence of an implicit copy constructor if there is a user-supplied copy assignment operator, and GCC 9 warns about that: src/qtui/settingspages/dccsettingspage.cpp: In member function ‘virtual void DccSettingsPage::load()’: src/qtui/settingspages/dccsettingspage.cpp:91:71: warning: implicitly-declared ‘DccConfig::DccConfig(const DccConfig&)’ is deprecated [-Wdeprecated-copy] Remove the copy assignment operator altogether and rely on the implicitly generated one, which does the same thing. --- src/common/dccconfig.cpp | 16 ---------------- src/common/dccconfig.h | 10 ---------- 2 files changed, 26 deletions(-) diff --git a/src/common/dccconfig.cpp b/src/common/dccconfig.cpp index 800ae885..93f6e9f9 100644 --- a/src/common/dccconfig.cpp +++ b/src/common/dccconfig.cpp @@ -37,22 +37,6 @@ DccConfig::DccConfig(QObject* parent) setAllowClientUpdates(true); } -DccConfig& DccConfig::operator=(const DccConfig& other) -{ - if (this == &other) - return *this; - - SyncableObject::operator=(other); - - static auto propCount = staticMetaObject.propertyCount(); - for (int i = 0; i < propCount; ++i) { - auto propName = staticMetaObject.property(i).name(); - setProperty(propName, other.property(propName)); - } - - return *this; -} - bool DccConfig::operator==(const DccConfig& other) { // NOTE: We don't compare the SyncableObject attributes (isInitialized, clientUpdatesAllowed()) diff --git a/src/common/dccconfig.h b/src/common/dccconfig.h index 565ddf8e..67fd9ef2 100644 --- a/src/common/dccconfig.h +++ b/src/common/dccconfig.h @@ -88,16 +88,6 @@ public: */ DccConfig(QObject* parent = nullptr); - /** - * Assignment operator. - * - * @note Only assigns properties relevant for config management! - * - * @param[in] other Right-hand side instance - * @returns The updated instance - */ - DccConfig& operator=(const DccConfig& other); - /** * Equality operator. * -- 2.20.1