gcc and qt-5.12.0 compilation error fix (#171)

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&)’ <deleted>
     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.
This commit is contained in:
trbogdanov 2022-10-26 12:13:53 +03:00 committed by GitHub
parent 90116239cf
commit 31849d1c12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public:
}
private:
static inline QMutex m_mutex;
static inline QMutex m_mutex{};
static inline QHash<QString, std::optional<QFunctionPointer>> m_functionCache = {};
};