summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-10-02 18:27:51 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-10-04 07:44:04 +0200
commit8b661846257670a1b8ef6b33593778c0f086c5e3 (patch)
treebf04d1b2636cd093c849db5d119163aa25b4818b /tests/auto/corelib/kernel
parent1cf0f8e7c3feb923ff08247d83d185c6aea986eb (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp4
1 files changed, 4 insertions, 0 deletions
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<QFile> s_file1;
+[[maybe_unused]] Q_CONSTINIT static QPointer<QFile> s_file2 = {};
+
void tst_QPointer::constructors()
{
QPointer<QObject> p1;