From 402ce8f266de19fdc4954db504debbb761159754 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 19 May 2022 10:38:48 +0200 Subject: [PATCH] QKeySequence: fix dynamic initialization of shared_empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QKeySequencePrivate default constructor wasn't constexpr, so shared_empty was not constinit'able. To make the constructor constexpr in C++17 as well as C++20, needed to replace the fill_n() on the key member with Uniform Initialization. Found by attempting to apply C++20 constinit to its definition. Pick-to: 6.3 6.2 Change-Id: I2941e96348eb969029da2f0f7231079967bba996 Reviewed-by: Tor Arne Vestbø Reviewed-by: Giuseppe D'Angelo --- src/gui/kernel/qkeysequence_p.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h index 9f8c6acfbbd..2f9a0b09aae 100644 --- a/src/gui/kernel/qkeysequence_p.h +++ b/src/gui/kernel/qkeysequence_p.h @@ -36,10 +36,7 @@ class QKeySequencePrivate { public: enum { MaxKeyCount = 4 }; // also used in QKeySequenceEdit - inline QKeySequencePrivate() : ref(1) - { - std::fill_n(key, uint(MaxKeyCount), 0); - } + constexpr QKeySequencePrivate() : ref(1), key{} {} inline QKeySequencePrivate(const QKeySequencePrivate ©) : ref(1) { std::copy(copy.key, copy.key + MaxKeyCount,