QApplicationStatic: avoid use of std::aligned_union

It's deprecated in C++23. Replace with std::aligned_union's
implementation, like done elsewhere in the code base.

Pick-to: 6.4
Fixes: QTBUG-107569
Fixes: QTBUG-99122
Change-Id: I0c06876c03a3c268298fab0f0bae399f26449bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2022-10-16 20:31:47 +02:00
parent f5205bd6a4
commit fdd0a1bc17

View File

@ -17,7 +17,7 @@ template <typename QAS> struct ApplicationHolder
using Type = typename QAS::QAS_Type; using Type = typename QAS::QAS_Type;
using PlainType = std::remove_cv_t<Type>; using PlainType = std::remove_cv_t<Type>;
Q_CONSTINIT static inline std::aligned_union_t<1, PlainType> storage = {}; Q_CONSTINIT static inline struct { alignas(Type) unsigned char data[sizeof(Type)]; } storage = {};
Q_CONSTINIT static inline QBasicAtomicInteger<qint8> guard = { QtGlobalStatic::Uninitialized }; Q_CONSTINIT static inline QBasicAtomicInteger<qint8> guard = { QtGlobalStatic::Uninitialized };
Q_CONSTINIT static inline QBasicMutex mutex {}; Q_CONSTINIT static inline QBasicMutex mutex {};