From 6990f51553d0b48f354a439ca5f2617e78fe58c8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 2 Oct 2023 18:27:51 +0200 Subject: [PATCH] tst_QPointer: ensure default-constructed objects are constinit'able Construction from nullptr isn't, because it's using the QPointer(T*) constructor, which cannot be constexpr. Pick-to: 6.5 Change-Id: I19129a0fca5873e83d20351a909a7994399bfcce Reviewed-by: Thiago Macieira (cherry picked from commit 8b661846257670a1b8ef6b33593778c0f086c5e3) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index 12556fa8bac..bade09be047 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -36,6 +36,10 @@ private slots: void constQPointer(); }; +// check that nullptr QPointer construction is Q_CONSTINIT: +[[maybe_unused]] Q_CONSTINIT static QPointer s_file1; +[[maybe_unused]] Q_CONSTINIT static QPointer s_file2 = {}; + void tst_QPointer::constructors() { QPointer p1;