From ae4f63613bf21691edbee91d5464b9ede5dee3fb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 16 Oct 2022 20:31:47 +0200 Subject: [PATCH] QApplicationStatic: avoid use of std::aligned_union MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit fdd0a1bc179e406b4af8c1dd2cc58bf8857d42ee) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qapplicationstatic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qapplicationstatic.h b/src/corelib/kernel/qapplicationstatic.h index d2e050a911f..f311da5d77e 100644 --- a/src/corelib/kernel/qapplicationstatic.h +++ b/src/corelib/kernel/qapplicationstatic.h @@ -17,7 +17,7 @@ template struct ApplicationHolder using Type = typename QAS::QAS_Type; using PlainType = std::remove_cv_t; - 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 guard = { QtGlobalStatic::Uninitialized }; Q_CONSTINIT static inline QBasicMutex mutex {};