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.

Fixes: QTBUG-107569
Fixes: QTBUG-99122
Change-Id: I0c06876c03a3c268298fab0f0bae399f26449bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fdd0a1bc179e406b4af8c1dd2cc58bf8857d42ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-10-16 20:31:47 +02:00 committed by Qt Cherry-pick Bot
parent 93503b0c52
commit ae4f63613b

View File

@ -17,7 +17,7 @@ template <typename QAS> struct ApplicationHolder
using Type = typename QAS::QAS_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 QBasicMutex mutex {};