Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
gcc and qt-5.12.0 compilation error fix (#171)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trbogdanov authored Oct 26, 2022
1 parent 9011623 commit 31849d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/FramelessHelper/Core/private/sysapiloader_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString, std::optional<QFunctionPointer>> m_functionCache = {};
};

Expand Down

0 comments on commit 31849d1

Please sign in to comment.