From 8f75f04df9164f082f2904a347317d5bc9163391 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. Change-Id: I2941e96348eb969029da2f0f7231079967bba996 Reviewed-by: Tor Arne Vestbø Reviewed-by: Giuseppe D'Angelo (cherry picked from commit 402ce8f266de19fdc4954db504debbb761159754) Reviewed-by: Qt Cherry-pick Bot --- 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 99d17e98d1b..b1ae3c8b50b 100644 --- a/src/gui/kernel/qkeysequence_p.h +++ b/src/gui/kernel/qkeysequence_p.h @@ -72,10 +72,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,