From 8b661846257670a1b8ef6b33593778c0f086c5e3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 2 Oct 2023 18:27:51 +0200 Subject: 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.6 6.5 Change-Id: I19129a0fca5873e83d20351a909a7994399bfcce Reviewed-by: Thiago Macieira --- tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib/kernel') diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index 12556fa8ba..bade09be04 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; -- cgit v1.2.3