From 31849d1c1271601e11999a71bef75d902c291d7e Mon Sep 17 00:00:00 2001 From: trbogdanov <109601123+trbogdanov@users.noreply.github.com> Date: Wed, 26 Oct 2022 12:13:53 +0300 Subject: [PATCH] gcc and qt-5.12.0 compilation error fix (#171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compililation with gcc (any version) and Qt 5.12.0 (important) fails with error: ``` Core/private/sysapiloader_p.h:59:26: error: no matching function for call to ‘QMutex::QMutex()’ static inline QMutex m_mutex; ^~~~~~~ include/QtCore/qmutex.h:165:5: note: candidate: ‘QMutex::QMutex(const QMutex&)’ Q_DISABLE_COPY(QMutex) ^~~~~~~~~~~~~~ ``` `QMutex` in Qt 5.12.0 has explicit (!) one-parameter constructor with a default value: `QMutex(QMutex::RecursionMode mode = NonRecursive)` and no default constructor. In this case declaring static inline member without initializer causes the above error. --- include/FramelessHelper/Core/private/sysapiloader_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/FramelessHelper/Core/private/sysapiloader_p.h b/include/FramelessHelper/Core/private/sysapiloader_p.h index 1a2e9f67..3a1b4afb 100644 --- a/include/FramelessHelper/Core/private/sysapiloader_p.h +++ b/include/FramelessHelper/Core/private/sysapiloader_p.h @@ -56,7 +56,7 @@ class FRAMELESSHELPER_CORE_API SysApiLoader : public QObject } private: - static inline QMutex m_mutex; + static inline QMutex m_mutex{}; static inline QHash> m_functionCache = {}; };