diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2021-09-16 13:17:24 +0300 |
---|---|---|
committer | Fabian Müller <80399010+fmoc@users.noreply.github.com> | 2021-09-17 11:37:57 +0300 |
commit | 4acec7bfdeeb798cdc7f32d6286dc7de07e17ef1 (patch) | |
tree | ef6b9c1cbf7323baf2e878c9ad1943326037f944 | |
parent | 857b5fd51b952efbcc907666b9a64c478ad934b9 (diff) |
Work around compiler bug in old GCC versions
The previous use of template specialisation triggered a compiler bug on
Debian 9 and CentOS 7, which use gcc 5.4 or earlier. As there is just
one specialisation, the work-around is to change the function to be a
static member function of the wrapping class of the enum.
See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
-rw-r--r-- | src/common/utility.h | 6 | ||||
-rw-r--r-- | src/gui/models/protocolitemmodel.cpp | 2 | ||||
-rw-r--r-- | src/libsync/syncfileitem.cpp | 3 | ||||
-rw-r--r-- | src/libsync/syncfileitem.h | 7 |
4 files changed, 4 insertions, 14 deletions
diff --git a/src/common/utility.h b/src/common/utility.h index 3d2e77bd7..fb3c22a5a 100644 --- a/src/common/utility.h +++ b/src/common/utility.h @@ -273,12 +273,6 @@ OCSYNC_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcUtility) { return QMetaEnum::fromType<E>().valueToKeys(value); } - template <class E = void> - QString enumDisplayName(E) - { - static_assert(std::is_same<E, void>::value, "Not implemented"); - Q_UNREACHABLE(); - } } /** @} */ // \addtogroup diff --git a/src/gui/models/protocolitemmodel.cpp b/src/gui/models/protocolitemmodel.cpp index 5d0d8395b..58e267cc8 100644 --- a/src/gui/models/protocolitemmodel.cpp +++ b/src/gui/models/protocolitemmodel.cpp @@ -70,7 +70,7 @@ QVariant ProtocolItemModel::data(const QModelIndex &index, int role) const case ProtocolItemRole::Account: return item.folder()->accountState()->account()->displayName(); case ProtocolItemRole::Status: - return Utility::enumDisplayName(item.status()); + return SyncFileItem::statusEnumDisplayName(item.status()); case ProtocolItemRole::ColumnCount: Q_UNREACHABLE(); break; diff --git a/src/libsync/syncfileitem.cpp b/src/libsync/syncfileitem.cpp index bf58fd407..ab7458b8d 100644 --- a/src/libsync/syncfileitem.cpp +++ b/src/libsync/syncfileitem.cpp @@ -75,8 +75,7 @@ SyncFileItemPtr SyncFileItem::fromSyncJournalFileRecord(const SyncJournalFileRec return item; } -template <> -QString Utility::enumDisplayName(SyncFileItem::Status s) +QString SyncFileItem::statusEnumDisplayName(Status s) { switch (s) { case SyncFileItem::NoStatus: diff --git a/src/libsync/syncfileitem.h b/src/libsync/syncfileitem.h index 68e597f20..971d75bde 100644 --- a/src/libsync/syncfileitem.h +++ b/src/libsync/syncfileitem.h @@ -95,6 +95,8 @@ public: }; Q_ENUM(Status) + static QString statusEnumDisplayName(Status s); + SyncJournalFileRecord toSyncJournalFileRecordWithInode(const QString &localFileName) const; /** Creates a basic SyncFileItem from a DB record @@ -276,11 +278,6 @@ public: QString _directDownloadCookies; }; - -template <> -OWNCLOUDSYNC_EXPORT QString Utility::enumDisplayName(SyncFileItem::Status s); - - inline bool operator<(const SyncFileItemPtr &item1, const SyncFileItemPtr &item2) { return *item1 < *item2; |